Re: How to run java on UNIX
Yes you can run a JAVA language in UNIX system because java is platform independent language.To run a java program you have to first install a jdk software of java in your system. There are different versions in jdk like jdk1.0,jdk2.0,jdk3.0.....jdk5.0. Any version will get compatible with your system. After installing you have to run java program from unix shell script.You must have jar files and classpath execution stuff.Below script will help you to run java program in any location.
#!/bin/sh
#- Main Base directories
chmod 777 thisshellscriptname.sh
echo "******* Enter your tool or project title *********"
# If you want some input from user
echo 'Enter Java Location************'
# or
# if you want java location
read varname
# Base dir path here (where your related jar files are located)
BASE_DIR="type path here"
#- Main .jar files
YOUR_JAR={BASE_DIR}/lib/YOUR_JARFILE.jar"
#- java
JAVA_EXECUTABLE="/usr/java/bin/java"
JAVA_HOME=`dirname /usr/java/bin/java`"/.."
#- main classpath
YOURCLASSPATH=.:${YOUR_JAR}
#- launching command
echo '**************YOUR TOOL NAME *************'
/usr/jdk1.5.0/bin/java -cp $YOURCLASSPATH MainClassFileName
# or
$varnamejava -cp $YOURCLASSPATH MainClassFileName
echo 'Successfully *****'
exit 0
Now you can run java program on your UNIX system.
Re: How to run java on UNIX
To run java program you must compile a java program in UNIX environment for that you must trigger jdk setup file. Follow the steps to do it :
1).Open your .login file for editing e.g., by typing > pico .login
if you are using a pico editor.
2). Go to the end of the .login file and add the following code in there (Make sure you do not make any other changes)
###########################################################################
#
# Source the jdk files
#
if (-r /usr/usc/jdk/1.4.2/setup.csh) then
source /usr/usc/jdk/1.4.2/setup.csh
endif
###########################################################################
3).Save the modified .login file.
4).Now you need to source the modified .login file by typing
> source .login
now you can start compiling your java program.
Re: How to run java on UNIX
You can execute your java program on UNIX. You must installed jdk first and should compile the code. after compiling you need to execute your code.To execute already compiled code prog_Name.java, you have to type
> java prog_Name at the UNIX prompt. Again, you must be in the directory where your program was compiled.