I am using Java 8 Nashorn to execute a specific previously agreeed upon method. I could Invoke the specific method no problem. One thing that bugged me though is that when I load the script, it also executes it.
For example if file.js contains a print("hello world!") the scriptEngine.eval(new FileReader("./file.js") would execute and print hello world. I have to do this before I could invoke the specific method I want.
Is there a way to eval()/load the scripts without executing it?
Thanks
FileReader?