Helma Logo
main list history
previous version  overview  next version

Version 10 by hannes on 21. September 2009, 15:46

This is a very short tutorial on how to install and start using Helma NG.

=== Installation[ant]: http://ant.apache.org/
[download]: http://github.com/hns/helma-ng/downloads
[github]: |http://github.com/hns/helma-ng/tree/master
[group]: http://groups.google.com/group/helma-ng
[irc]: http://helma.server-side-javascript.org/hopbot/
[demo]: http://helma-ng.appspot.com/

Helma requires Java 1.5 to run and uses *Apache Ant|http://ant.apache.org/* as its build tool. ### Installation

To get started with Helma NG either *download the latest release|http://githubrequires Java 1.com/hns/helma-ng/downloads* or get the current snapshot *from Github|http://github5 to run and uses [Apache Ant][ant] as its build tool.com/hns/helma-ng/tree/master*, either by clicking the download button or using the following git command:

<tt style="font-weight:bold;color:#d33;">git clone git://github.com/hns/helma-ng.git</tt>To get started with Helma NG either [download the latest release][download] or get the current snapshot [from Github][github], either by clicking the download button or using the following git command:

`git clone git://github.com/hns/helma-ng.git`

Change to the helma-ng directory you just checked out and run ant it with the "jar" target:

<tt style="font-weight:bold;color:#d33;">ant jar</tt>`ant jar`

If this worked then you should now have a file called lib/helma.jar.

=== ### Using the shell

Once you have built the jar files you should be able to start the *Helma NG shell|shell*. Just run the helma script in the bin directory without arguments:

<tt style="font-weight:bold;color:#d33;">/bin/helma</tt>`bin/helma`

This should start a shell session with a <tt>helma&gt;</tt> `helma>` prompt. You can enter and evaluate any JavaScript expression. You can scroll through your session history using the <Up> and <Down> keys, hitting <Tab> will try to auto-complete your current input. Use the <tt>include</tt>`include`, <tt>require</tt>`require`, or <tt>import</tt> `import` functions to load any Helma NG modules:

<tt>helma>     helma> include('helma/file');
    helma> var file = new File('README.txt');
    helma> file.open();
    helma> file.readln();
    Helma NG
    helma> file.close();
true</tt>    true

=== ### Running the demo app

To run an actual web application simply pass the main file of the app to the helma command:

<tt style="font-weight:bold;color:#d33;">/bin/helma `bin/helma apps/demo/main.js</tt>js`

This will start the *Helma [Helma NG demo app|http://helma-ng.appspot.com/* app][demo] on port 8080. Enter the following URL in your browser to access the app:


You can also run an application and the shell at the same time by adding the -i `-i` or --interactive `--interactive` option before the application name: 

<tt style="font-weight:bold;color:#d33;">/bin/helma `bin/helma -i apps/demo/main.js</tt>js`

Use the -h `-h` or --help flag `--help` options for more information on available options.

=== ### Starting your own application

To start hacking on your own Helma application, use the admin/create script to create a new app:

<tt style="font-weight:bold;color:#d33;">/bin/helma `bin/helma admin/create [app directory]</tt>directory]`

If you don't pass the app directory on the command line the script will prompt you for it. Once the application has been created you can start it by running its main.js script:

<tt style="font-weight:bold;color:#d33;">/bin/helma `bin/helma appname/main.js</tt>js`

If you like Helma NG drop a note on the *mailing list|http://groups.google.com/group/helma-ng* [mailing list][group] or the *#helma [#helma channel on irc.freenode.net|http://helma.server-side-javascript.org/hopbot/*!net][irc]!