import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class ExecuterFichierScript
{
public static void main(String[] args) throws Exception
{
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine jsEengine = manager.getEngineByExtension("js");
Reader reader = new InputStreamReader(new FileInputStream("fichier.js"));
jsEengine.eval(reader);
}
}