public static void main(String[] args) throws Exception {
System.out.println("\nTest4\n");
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = Helper.getJsEngine(m);
if (e == null) {
System.out.println("Warning: No js engine found; test vacuously passes.");
return;
}
e.eval(new FileReader(
new File(System.getProperty("test.src", "."), "Test4.js")));
Invocable inv = (Invocable)e;
Runnable run1 = (Runnable)inv.getInterface(Runnable.class);
run1.run();
// use methods of a specific script object
Object intfObj = e.get("intfObj");
Runnable run2 = (Runnable)inv.getInterface(intfObj, Runnable.class);
run2.run();
}
Test4.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录