Skip to content

Instantly share code, notes, and snippets.

@vborja
Created October 14, 2008 19:31
Show Gist options
  • Save vborja/16774 to your computer and use it in GitHub Desktop.
Save vborja/16774 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>BeanShell scripting example</title>
<script type="text/javascript" src="http://github.com/vic/jwmscript/tree/master/core/src/main/resources/com/jwmsolutions/jwmscript/applet.js?raw=true"></script>
<script type="text/javascript">
JWMScript({
archive: "http://github.com/vborja/jwmscript-example/tree/master/signed/jwmscript-core-0.0.1.jar?raw=true",
types : ["text/java", "text/beanshell"],
setup : function(scripting) {
alert("Setting up JWMScript");
scripting.addClassPath("http://github.com/vborja/jwmscript-example/tree/master/signed/bsh-2.0b4.jar?raw=true");
var interpreter = scripting.wrapClass("bsh.Interpreter").newInstance();
interpreter.set("jwmscript", scripting.getHandle());
return function(script) { interpreter.eval(script.innerHTML); };
}
});
</script>
<script type="text/beanshell">
jwmscript.alert( "Hello from BeanShell" );
</script>
</head>
<body>
<h1>Hello World example scripted with BeanShell</h1>
<p>
<a href="http://beanshell.org">BeanShell</a> is an scripting language.
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment