Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScriptEngine is Null for getEngineByName("JavaScript")?

ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");

engine is null??? Also i try to iterate through the scriptEnginefactories it's zero...

i have js-1.7R1.jar on my classpath...can anyone tell me what i need to do else to register the javascript engine( I found Rhino which is js-1.7r.jar)

Thanks.

like image 793
Jeryl Cook Avatar asked Sep 02 '25 09:09

Jeryl Cook


1 Answers

"Eclipse uses its own compiler, but uses the system's JRE..." - Bart Kiers

Make sure the JRE is 1.6 or higher. Based on the comments, Jeryl Cook had eclipse set to JRE 1.5. He removed this from inside eclipse and added JRE 1.6 which worked and solved his problem.

like image 87
Kyle Bridenstine Avatar answered Sep 05 '25 00:09

Kyle Bridenstine