Skip to content

Instantly share code, notes, and snippets.

@miya2000
Created May 9, 2009 05:32
Show Gist options
  • Save miya2000/109147 to your computer and use it in GitHub Desktop.
Save miya2000/109147 to your computer and use it in GitHub Desktop.
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