Functional Area : Start-Up Environment and Command-Line

The main class to run JudoScript on the command-line is judo. It normally runs a script file, but can run a short program specified on the command-line itself, or compile a script without executing.

To run a script, this is the general format:

java [ java-options ] judo [ judo-option ] script_name [ script-parameters ]
JudoScript script file names normally end with .judo, although it can be anything; included file names normally end with .judi.

The script file and its included files, if any, are located in this order:

  1. the specified path
  2. directories listed in a system propertied called JUDOPATH
  3. $HOME/.judobase
  4. c:/judobase on Windows or /usr/judobase otherwise
  5. the CLASSPATH for the current JVM (can be turned off with -Dnocp Java option.)
Item 3 and 4 allow users to store common programs in a common place. JUDOPATH uses the same format as Java CLASSPATH except that ZIP or JAR files are not supported. It is optional, and is defined as a JVM system property (the -D option). JVM CLASSPATH is searched last, ZIP and JAR files can include JudoScript scripts. This can be turned off if the JVM system property nocp is specified.

Judo-Option:

Script-Parameters: any further parameters on the command-line are passed in to the script as its parameters; they are accessible in the program by the predefined constant array, #cmd_args . JudoScript supports a simple yet useful parameter format: if specified parameter is like -name=value or -name:value, it is deemed as an option; the value can be omitted which will be defaulted to 1. These options are accessible in the program by the predefined constant ordered map #options . The rest of the parameters are accessed as constant array #args .

A special JudoScript option, -? or --helper, tells the JudoScript engine to print out a help message, specified at the beginning of the script as UsageDeclaration. The UsageDeclaration can also specify a minimum number of arguments, and if the number of arguments on the command-line is less than that, the engine also displays the help message and aborts.

Related Functional Areas

Related Syntax

Related Object Types