Versions Compared

Key

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

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.

...

  1. Download the zip file containing the HJ package from
  1. https://svn.rice.edu/r/comp322/course/downloads/hj-1.2.0-2011-01-06.zip

...

  1. Lets

...

  1. call

...

  1. the

...

  1. zip

...

  1. file

...

  1. ’hj-version.zip’.

...

  1. Unzip

...

  1. the

...

  1. file
    unzip hj-version.zip

...

  1. This

...

  1. will

...

  1. create

...

  1. a

...

  1. folder,

...

  1. namely

...

  1. '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

...

  1. the

...

  1. environment

...

  1. variable

...

  1. HJ

...

  1. HOME

...

  1. to

...

  1. the

...

  1. ’hj-version’

...

  1. folder.

...


  1. export HJ HOME=<full-path-to-hj-version-folder>

...


  1. OR
    <Go to the hj-version

...

  1. folder>
    export HJ HOME=`pwd`

...

  1. Set

...

  1. the

...

  1. environment

...

  1. variable

...

  1. PATH.

...


  1. export PATH=$HJ

...

  1. HOME/bin:$PATH

...

  1. You

...

  1. should

...

  1. have

...

  1. the

...

  1. environment

...

  1. variable

...

  1. JAVA

...

  1. HOME

...

  1. set

...

  1. to

...

  1. run

...

  1. HJ

...

  1. programs.

...

  1. Some

...

  1. machines

...

  1. would

...

  1. have

...

  1. it

...

  1. set

...

  1. when

...

  1. you

...

  1. log

...

  1. in.

...

  1. If

...

  1. it

...

  1. is

...

  1. not

...

  1. set

...

  1. already,

...

  1. you

...

  1. have

...

  1. to

...

  1. set

...

  1. it

...

  1. as

...

  1. follows.

...


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

...


  1. In your lab machines,

...

  1. the

...

  1. java

...

  1. sdk

...

  1. can

...

  1. be

...

  1. found

...

  1. at

...

  1. /etc/alternatives/java

...

  1. sdk

...

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

...

  1. Set

...

  1. the

...

  1. environment

...

  1. variable

...

  1. HJ

...

  1. HOME

...

  1. to

...

  1. the

...

  1. ’hj-version’

...

  1. folder.

...


  1. set HJ HOME=<full-path-to-hj-version-folder>

...


  1. OR
    <Go to the hj-version

...

  1. folder>
    set HJ HOME=`pwd`

...

  1. Set

...

  1. the

...

  1. environment

...

  1. variable

...

  1. PATH.

...


  1. set PATH=${HJ

...

  1. HOME}/bin:${PATH}

...

  1. You

...

  1. should

...

  1. have

...

  1. the

...

  1. environment

...

  1. variable

...

  1. JAVA

...

  1. HOME

...

  1. set

...

  1. to

...

  1. run

...

  1. HJ

...

  1. programs.

...

  1. Some

...

  1. machines

...

  1. would

...

  1. have

...

  1. it

...

  1. set

...

  1. when

...

  1. you

...

  1. log

...

  1. in.

...

  1. If

...

  1. it

...

  1. is

...

  1. not

...

  1. set

...

  1. already,

...

  1. you

...

  1. have

...

  1. to

...

  1. set

...

  1. it

...

  1. as

...

  1. follows.

...


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

...


  1. In your lab machines,

...

  1. the

...

  1. java

...

  1. sdk

...

  1. can

...

  1. be

...

  1. found

...

  1. at

...

  1. /etc/alternatives/java

...

  1. sdk

...

  1. sun.

...

HJ

...

-

...

Testing

...

Do

...

the

...

following

...

to

...

check

...

if

...

your

...

HJ

...

is

...

setup

...

properly.

...

  1. Go

...

  1. to

...

  1. a

...

  1. folder

...

  1. with

...

  1. an

...

  1. HJ

...

  1. program.

...

  1. Lets

...

  1. say

...

  1. we

...

  1. go

...

  1. to

...

  1. hj-version/examples/fib/

...

  1. which

...

  1. contains

...

  1. an

...

  1. HJ

...

  1. program

...

  1. that

...

  1. computes

...

  1. the

...

  1. Fibonacci

...

  1. of

...

  1. a

...

  1. given

...

  1. input

...

  1. number.

...


  1. cd $HJ_HOME/examples/fib

...

  1. Compile

...

  1. the

...

  1. HJ

...

  1. program,

...

  1. Fib.hj

...


  1. hjc Fib.hj

...

  1. Run

...

  1. the

...

  1. HJ

...

  1. program

...

  1. with

...

  1. appropriate

...

  1. arguments,

...

  1. Fib

...

  1. with

...

  1. an

...

  1. input

...

  1. 10.

...


  1. hj Fib 10
  2. You should get the following result, which is the Fibonacci value of 10.
    55

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

...

  1. Now

...

  1. you

...

  1. have

...

  1. the

...

  1. jar

...

  1. file.

...

  1. Lets

...

  1. call

...

  1. it

...

  1. 'drjava-version.jar'.

...

  1. You

...

  1. are

...

  1. all

...

  1. set

...

  1. to

...

  1. use

...

  1. the

...

  1. DrJava-HJ

...

  1. gui

...

  1. for

...

  1. HJ

...

  1. programs

...

Testing

Do the following to check if the DrJava-HJ

...

gui

...

is

...

setup

...

properly.

...

  1. Open

...

  1. the

...

  1. DrJava-HJ

...

  1. gui
    java -jar

...

  1. drjava-version.jar

...

  1. Now

...

  1. you

...

  1. should

...

  1. have

...

  1. the

...

  1. DrJava-HJ

...

  1. gui

...

  1. running.

...

  1. Open

...

  1. a

...

  1. HJ

...

  1. program.

...

  1. Lets

...

  1. say

...

  1. we

...

  1. open

...

  1. hj-version/examples/fib/Fib.hj.

...


  1. Click on the open button on the top panel
    Navigate to the folder containing Fib.hj
    Select Fib.hj and click open
  2. Compile the HJ program.
    Click on the compile button on the top panel
  3. The 'Compiler Output' tab in the bottom panel should show 'Compilation Completed'.
  4. 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.
  5. Go to the 'Interactions' tab in the bottom panel. Run the program by typing the following.
    run Fib 10
  6. You should get the following output.
    55