====== pluggablejs ====== [[:|Projects index]] ===== Details ===== * Current version: 1.1.1build36, published on July 5th 2008 * Released under a [[http://www.linfo.org/bsdlicense.html|Two-clause BSD license]] * Requires at least [[http://sun.java.com|Java]] v6 ===== Description ===== pluggablejs is a wrapper around Java's built-in JavaScript engine intended to load pieces of JavaScript code as plugins for programs. \\ It's a part of some of my Java programs, others can use it although in many cases an ad-hoc solution might be preferable. Additionally it [[#shell_usage|can be used as a shell]] to run arbitrary JavaScript code with some extra convenience objects available, although for such uses [[http://www.beanshell.org/|BeanShell (bsh)]] makes a lot more sense. \\ My own, much simpler, [[:javacode#RhinoRun]] can also be used to run arbitrary JavaScript. ===== Download ===== * Binary jar * [[/files/pluggablejs/pluggablejs-1.1.1build36.jar|pluggablejs-1.1.1build36.jar]] * ''net.outlyer.plugins.Shell'' wrappers * Windows\\ \_ [[/files/pluggablejs/pjsh.cmd|pjsh.cmd]] * Linux/Unix\\ \_ [[/files/pluggablejs/pjsh.sh|pjsh.sh]] * [[//www.debian.org/|Debian]] binary package * [[deb>files/pluggablejs/libpluggablejs-java_1.1.1build36-upstream.0_all.deb|libpluggablejs-java_1.1.1build36-upstream.0_all.deb]] * Source jar * [[/files/pluggablejs/pluggablejs-1.1.1build36-src.jar|pluggablejs-1.1.1build36-src.jar]] * Source code Will upload soon, see the source jar instead * pluggablejs-1.1.1.tar.gz\\ Includes source code and some sample usages. out.println("Hello World!") $ java -cp pluggablejs.jar net.outlyer.plugins.Shell helloworld.js Hello World! ---- out.println("Hello " + ui.prompt("What's your name?")) $ java -cp pluggablejs.jar net.outlyer.plugins.Shell namedhello.js What's your name?: Toni Hello Toni ---- // Includes usage of callbacks and reference to variables defined later on hooks.atexit(function() { out.println('And bye '+you+'!') }); var you = ui.prompt("What's your name?") out.printf("Hello %s!\n", new Array(you)) $ java -cp pluggablejs.jar net.outlyer.plugins.Shell hellobye.js What's your name?: Toni Hello Toni! And bye Toni! ---- java.lang.System.out.println("Hello world without wrapping"); $ java -cp pluggablejs.jar net.outlyer.plugins.Shell plainjava.js Hello world without wrapping ===== Caveats ===== * The first line is evaluated twice, so it shouldn't have side effects. ===== TBD: More details to come ===== ----
© 2008 Toni Corvera <outlyer at gmail dot com>