Search This Blog

Thursday, March 27, 2014

Compiling Java Programs (csh)



The basic requirement to compile and execute java programs on unix is to have jdk installed on box..

If  available, you would be able to see the setup file named setup.csh at /usr/usc/jdk/<version num>/

U need to run the setup file.For this add this to .login.

If [ -f /usr/usc/jdk/1.4.2/setup.csh ]
then
source /usr/usc/jdk/1.4.2/setup.csh
fi

Here source is used to call the file in current shell.
Once after this u can compile ur java program something like

%javac program.java

It creates a .class file with same name of ur java program i.e. program.class
In order to execute already compiled program.java following cmd can be used.

%java program

No comments:

Post a Comment