Copyright, Stephan Diehl, 2000-2003

Java Old-Style Shell

JOSH is a Java interpreter. It was designed to ease teaching Java to beginners. We believe that they should learn basic programming concepts, before they are exposed to classes and objects.

With JOSH beginners can interactively evaluate simple expressions, execute program statements and define variables (fields) and functions (methods). After they are familiar with these concepts they can define new classes.

Since JOSH is implemented as a front end to the Java compiler, it accepts (almost) the full Java syntax. As a result, we do not have to explain the syntax here. Instead we explain the commands of JOSH and provide an annotated example session which demonstrates the features of JOSH.

Installation

JOSH requires Java version 1.2 and higher. If you use Java version 1.3 and higher you should use the installation file to install JOSH. Download the installation file and run

  java -jar joshinstall.jar
If you use Java version 1.2, you should download the ZIP-distribution file, unpack it and customize the batch files and the file josh.properties manually.
If you encounter any problems after installation: Check the file josh.properties to adjust class paths and the execution path of the programs "java" and "javac" of the JDK1.2 or higher. If you use Windows you might also have to change the file josh.bat. Change the path in the line "set JOSHDIR=..." to the path where you installed JOSH.

How to start JOSH

Windows and Unix:
   josh

   josh example.josh
On UNIX platforms the following also works:
   josh < example.josh
And as JOSH thus reads and interpretes files, it can be used as a shell in shell-scripts:
   %/bin/josh
   System.out.println("The most expensive ECHO");

Commands:

All commands of JOSH start with a dollar sign '$' at the beginning of the line. All other input is interpreted by JOSH as a Java expression, declaration or statement. $help prints a summary of all commands of JOSH:
  $compile file.java     Compile file named 'file.java'
  $edit                  Interprete input created with external editor
  $josh file.josh        Interprete file named 'file.josh'
  $edit file.java        Edit file named 'file.java' in external editor
  $execute classname     Execute class
  $exit                  Exit interpreter
  $quit                  Exit interpreter

An Example Session

To see an example session start JOSH with the file example.josh:
  josh example.josh

Known Restrictions of JOSH: