1.8 Working with command-line scripts

If the user wants to run Jython scripts from jHepWork without the main editor, he/she should set the CLASSPATH variable to libraries located in the lib directory. One can find an example bash script a_run.sh in the directory macros/examples. One can run the example files as: a_run.sh file.py from the Linux/UNIX prompt.

It is however more convenient to use ANT [10] build.xml to run and compile Jython scripts using the command line, since ANT is a multi-platform tool. jHepWork has a special build.xml script which allows to run and compile Jython macros from the command line without the main editor. Go to the directory: macros/cmd and type ant. If the ANT tool is installed, one should see command-line options to run or compile the scripts. For example, to run histo1.py script without the main editor, type:

bash#: ant run -DM histo1
If you want to compile this script in a jar library, type:

bash#: ant jarpy  -DM histo1
If one wants to compile the standard Java source files and create a jar library, one should put source files to the src directory and execute ant jarjava.

In all such cases, it is assumed that the user is working in the cmd directory. If one needs to work in some other directory, modify the variable jhepwork in the build.xml file.