Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
| *[Home|COMP322]* | *[Owlspace Course Site - Section 1|https://owlspace-ccm.rice.edu/portal/site/COMP-322-ELEC-323-A01-Sp11]* | *[Owlspace Course Site - Section 2|https://owlspace-ccm.rice.edu/portal/site/COMP-322-ELEC-323-A02-Sp11]* | *[Office Hours|322OfficeHours]* | *[Turnin Guide|322TurninGuide]* | *[HJ Release|322Resources]* |

h1. Download and Setup HabaneroJava (HJ) Package

Note that the HJ package is meant to run only on Linux and MacOS. If you have a Windows machine, you will have to remotely login to one of the lab machines and work on it. Please contact the staff if you need help to do that.

h3. HJ - Download and Install

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

# Download the zip file containing the HJ package from [

Download and Setup HabaneroJava (HJ) Package

Note that the HJ package is meant to run only on Linux and MacOS. If you have a Windows machine, you will have to remotely login to one of the lab machines and work on it. Please contact the staff if you need help to do that.

HJ - Download and Install

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

...

https://svn.rice.edu/r/comp322/course/downloads/hj-1.2.0-2011-01-06.zip

...

]
# Lets call the zip file ’hj-version.zip’.

...


# Unzip the

...

 file
       _unzip hj-version.zip

...

_
# This will create a folder, namely 'hj-version'

...



h3. 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.

...



# Set the environment variable HJ HOME to the ’hj-version’ folder.

...

 
     _export HJ HOME=<full-path-to-hj-version-folder>

...

Testing

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

...

_
     OR
     _<Go to the hj-version folder>_
     _export HJ HOME=`pwd`_
# Set the environment variable PATH.
     _export PATH=$HJ HOME/bin:$PATH_
# 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 sdk sun.

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.

# 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`_
# Set the environment variable PATH.
     _set PATH=${HJ HOME}/bin:${PATH}_
# 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.

h5. HJ - Testing

Do the following to check if your HJ is setup properly.
# Go to a folder with an HJ program. Lets say we go to hj-version/examples/fib/ which contains an HJ program that computes the Fibonacci of a given input number.

...


       _cd $HJ_HOME/examples/fib

...

_
# Compile the HJ program, Fib.hj

...


       _hjc Fib.hj

...

_
# Run the HJ program with appropriate arguments, Fib with an input 10.

...

DrJava-HJ

...


       _hj Fib 10_
# You should get the following result, which is the Fibonacci value of 10.
       _55_



h3. DrJava-HJ

# 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

...

]
# Now you have the jar file. Lets call it 'drjava-version.jar'.

...


# You are all set to use the DrJava-HJ gui for HJ programs

...

Testing

...



h5. Testing

Do the following to check if the DrJava-HJ gui is setup properly.

...


# Open the DrJava-HJ

...

 gui
       _java -jar drjava-version.jar

...

_
# Now you should have the DrJava-HJ gui running.

...


# Open a HJ program. Lets say we open hj-version/examples/fib/Fib.hj.

...


       _Click on the open button on the top panel_
       _Navigate to the folder containing Fib.hj_
       _Select Fib.hj and click open_
# Compile the HJ program.
       _Click on the compile button on the top panel_
# The 'Compiler Output' tab in the bottom panel should show 'Compilation Completed'.
# 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.
# Go to the 'Interactions' tab in the bottom panel. Run the program by typing the following.
       _run Fib 10_
# You should get the following output.
       _55_