setenv JAVA_HOME /uns/usr/jdk
setenv CLASSPATH $JAVA_HOME/classes:/homes/iws/csk/Java
setenv LD_LIBRARY_PATH $JAVA_HOME/lib/alpha_osf32c
Next, you should actually cause those lines to be executed. You
can do this with the command source ~/.mycshrc
, or
you can log out and in again.
CLASSPATH
.
In the file PrintMessage.java
, put the following:
public class PrintMessage { private String message; public PrintMessage( String message ) { this.message = message; } public void print() { System.out.println( message ); } }
Then, in the file HelloWorld.java
, put the following:
public class HelloWorld { public static final void main( String[] args ) { PrintMessage msg = new PrintMessage( "Hello, World!" ); msg.print(); } }
Note that the names of the classes correspond to the names of the files they're in. This is important!
javac HelloWorld.java
. This should create two
new files, HellowWorld.class
and
PrintMessage.class
, which are like object files
in C.
java
and pass it as a first
argument the particular class you want to start with. So, in
this case, you'd execute java HelloWorld
.