Java tutorial
//package com.java2s; import java.io.FileReader; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; public class Main { public static Object getValue(String filepath, String key) { try { ScriptEngineManager sem = new ScriptEngineManager(); ScriptEngine jsEngine = sem.getEngineByName("js"); jsEngine.eval(new FileReader(filepath)); return jsEngine.get(key); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }