Jls is a general-purpose JavaScript platform. It aims to provide an extensible tooling framework. Jls can be used for various purposes including client-side, server-side or desktop scripting. Jls comes in two parts: a low level set of native libraries and a set of JavaScript libraries.
Jls has reached end of life in October 2020 and is no more actively supported. Fortunately there are plenty of valuable alternatives for JavaScript scripting such as Node.js
The jls native JavaScript engine is based on the Netscape Portable Runtime library and SpiderMonkey. The jls native libraries support multiple hosts, currently windows, linux, mac and web browsers.
The jls JavaScript libraries are dynamically loadable and provide abstraction interfaces for general-purpose scripting, current interfaces allow the use of file system, graphical user interface, network, database, etc.
Jls is an open source project licensed under the LGPL The JavaScript libraries source code is included in the distribution, you can also browse it online in the API documentation.
Download it, extract it somewhere, open a console and simply run:
> jls Usage: jls [options] script [args...] where options include: -bs <bootstrap script file name> The file name of the script to use for bootstrap. -ep <extension path> A directory to search for native library files, script ZIP files and directories. -lp <library search path of directories> A ; separated list of directories to search for native library files. -sp <script search path of directories and ZIP files> A ; separated list of directories and ZIP archives to search for script files. -D<name>=<value> Set a system property.
The script that you want to run must be available in the extension or the script path. The native library that you want to load must be available in the extension or the library path. The default extension path is which includes all the default libraries.
You can found more information in the documentation.
The following packages are available in the default runtime archive (rt.zip).
Since 0.5, jls is based on AMD for defining its classes and provides a global function.
The tests are available in the test archive (test.zip).
> jls jls/jsunit/TestRunner -all 96 test(s): 0 error(s) and 0 failure(s)
The following is the hello world script.
var System = require('jls/lang/System'); var InputStreamReader = require('jls/io/InputStreamReader'); var BufferedReader = require('jls/io/BufferedReader'); System.out.print('Please, enter your name : '); var reader = new BufferedReader(new InputStreamReader(System.in)); var name = reader.readLine(); System.out.printf('Hello %s !', name);
And the following is the execution result.
> jls hello.js Please, enter your name : spyl Hello spyl !
Other examples are available in the demo archive (demo.zip).