Created
May 9, 2009 05:32
-
-
Save miya2000/109147 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jstest; | |
import org.mozilla.javascript.*; | |
import org.mozilla.javascript.tools.shell.*; | |
public class JsTest { | |
public static void main(String[] args) throws Exception { | |
try { | |
Context cx = Context.enter(); | |
Global scope = new Global(); | |
scope.init(cx); | |
cx.evaluateString(scope, "load('dist/env.rhino.js')", "<cmd>", 1, null); | |
cx.evaluateString(scope, "window.location = 'test.html'", "<cmd>", 1, null); | |
cx.evaluateString(scope, "load('dist/jquery.js')", "<cmd>", 1, null); | |
cx.evaluateString(scope, "print($('body').text())", "<cmd>", 1, null); | |
} | |
finally { | |
Context.exit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment