Kanchi
Lab2 : FIRST JAVA PROGRAM
CPSC 101 : Computing and Algorithms I
Set Up for running Java Programs.
-
First edit your .cshrc file and add the following lines of code at the
end:
set path = ( /usr/local/lang/jdk1.1.6/bin $path )
set CLASSPATH = ( /usr/local/lang/jdk1.1.6/lib/classes.zip )
-
Now logout of the system and login back again.
Writing the first Java Program
-
Now using an editor create a file "example1.java" as in the
Example1 used in class
-
Use the command "javac example1.java" to compile your code. If you get
errors, check to make sure you have made no spelling errors, and then consult
me.
-
Use the command "java HelloWorld" to interpret the bytecode created, if
your compilation was successful.
-
(Task) Show that your program works.
(TasK) You will print a hard-copy of a file containing the HellooWorld
program.
Can you also print your name and your computer background in
the example1 program?