• HJDownload
Skip to end of metadata
Go to start of metadata

Download and Setup Instructions for Habanero-Java (HJ) installations

There are two installations available for HJ.  One uses an IDE installation called DrHJ which works on Linux, Mac OS, and Windows.  The other uses a command-line installation, which is only supported on Linux and MacOS but not Windows. If you have a Windows machine, you will have to remotely login to a Linux lab machine to use the command-line installation. Please contact Vincent Cavé if you have any questions with installing any of the software listed below.  You can find a number of sample HJ programs and lab exercises in the COMP 322 web page.

1) DrHJ - Download and Install

DrHJ is an IDE for HJ. You can edit, compile and run HJ programs from within this IDE.  DrHJ runs on Unix-based platforms (e.g., Ubuntu, Mac OS, etc) and also on some Windows installations.  (For Windows, you should download a standard full JDK from Oracle to maximize the chances of DrHj working on your system.)

  1. Download the jar file corresponding to DrHJ
  2. This jar file should be called ’drhj.jar’.  If not, please use the actual name instead of drhj.jar in the instructions below.

DrHJ - Setup

There is no setup needed for DrHJ.

DrHJ - Testing

Here are the instructions to compile and run HJ programs using the DrHJ IDE.

  1. Open the DrHJ IDE
    java -jar drhj.jar
  2. Now you should have the DrHJ IDE running.
  3. Open a HJ program.
    Click on the open button on the top panel
    Navigate to the folder ’hj-version/examples/HelloWorld’, which contains an HJ program, HelloWorld.hj
    Select HelloWorld.hj and click open
  4. Compile the HJ program.
    Click on the compile button on the top panel
  5. The 'Compiler Output' tab in the bottom panel should show 'Compilation Completed'.
  6. Go to the 'Console' tab in the bottom panel and check if there were any errors during compilation. All errors will be shown in RED.
  7. Go to the 'Interactions' tab in the bottom panel. Run the program by typing the following.
    run HelloWorld

2) HJ - Download and Install

You will have to download and install HJ once for every machine you plan to use HJ on.

  1. Download the zip file containing the HJ package
  2. Lets call the zip file ’hj-version.zip’.
  3. Unzip the file
    unzip hj-version.zip
  4. This will create a folder, namely 'hj-version'

HJ - Setup

You will have to setup the environment before you can compile and run HJ programs. This has to be done every time you login to a machine or start a new shell. These commands are specific to the shell you use.

You can figure out which shell you are using with the following command.
ps -p $$

Here are the commands if you are using a bash shell.

  1. Set the environment variable HJ HOME to the ’hj-version’ folder.
    export HJ_HOME=<full-path-to-hj-version-folder>
    OR
    <Go to the hj-version folder>
    export HJ_HOME=`pwd`
    Note that you need to use `backquote` in the above command.
  2. Set the environment variable PATH.
    export 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.
    export JAVA_HOME=<full-path-to-java-sdk>
    In your lab machines, the java sdk can be found at /etc/alternatives/java

Here are the commands if you are using a c shell (csh) or a variant (tcsh) of it. Your lab machines’ default shell when you login is tcsh.

  1. Set the environment variable HJ HOME to the ’hj-version’ folder.
    setenv HJ_HOME <full-path-to-hj-version-folder>
    OR
    <Go to the hj-version folder>
    setenv HJ_HOME `pwd`
    Note that you need to use `backquote` in the above command.
  2. Set the environment variable PATH.
    setenv 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.
    setenv JAVA_HOME <full-path-to-java-sdk>
    In your lab machines, the java sdk can be found at /etc/alternatives/java

HJ - Testing

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 ’hj-version/examples/HelloWorld’ which contains an HJ program, HelloWorld.hj.
  2. Compile the HJ program
    hjc HelloWorld.hj
  3. Run the HJ program
    hj HelloWorld
  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
  • No labels