Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Set the environment variable HJ HOME to the ’hj-version’ folder.
    set HJ HOME=<full-path-to-hj-version-folder>
    OR
    <Go to the hj-version folder>
    set HJ HOME=`pwd`
  2. Set the environment variable PATH.
    set PATH=${HJ HOME}/bin:${PATH}
  3. You should have the environment variable JAVA HOME set to run HJ programs. Some machines would have it set when you log in. If it is not set already, you have to set it as follows.
    Check if your JAVA HOME is set.
    echo $JAVA HOME
    If this prints an empty line, it is not set. Do the following.
    set JAVA HOME=<full-path-to-java-sdk>
    In your lab machines, the java sdk can be found at /etc/alternatives/java sdk sun.
HJ - Testing

Do the following to check if your HJ is setup properly.

Now you are all set to compile and run HJ programs. Here are the instructions to compile and run an HJ program in the command line.

  1. Go to the folder ’hjGo to a folder with an HJ program. Lets say we go to hj-version/examples/fib/ HelloWorld’ which contains an HJ program that computes the Fibonacci of a given input number.
    cd $HJ_HOME/examples/fib, HelloWorld.hj.
  2. Compile the HJ program, Fib.hj
    hjc FibHelloWorld.hj
  3. Run the HJ program with appropriate arguments, Fib with an input 10.
    hj Fib 10HelloWorldYou should get the following result, which is the Fibonacci value of 10.
    55
  4. This should print ’HelloWorld’.
  5. To control the number of places and threads your HJ program runs on, use the ’-places’ option as follows.
    hj -places 1:2 HelloWorld // This runs on 1 place with 2 threads

DrJava-HJ

  1. Download the jar file corresponding to DrJava-HJ from https://svn.rice.edu/r/comp322/course/downloads/drjava-r5422-hj-1.2.0.0.jar
  2. Now you have the jar file. Lets call it 'drjava-version.jar'.
  3. You are all set to use the DrJava-HJ gui for HJ programs

...