Monday, January 18, 2010

How to Run Java Program in Unix

This article address the how to run java program/project from unix shell script. If you have jar files and those jar files path and classpath execution stuff are explained in this below shell script.Below script will help you to run java program in any location.
Replace red color text with your content.

      Here is the script used to run java project
#- Main Base directories
chmod 777
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
 #- java
 JAVA_HOME=`dirname /usr/java/bin/java`"/.."
#- main classpath


#- launching command
     echo '**************YOUR TOOL NAME *************'
   /usr/jdk1.5.0/bin/java -cp $YOURCLASSPATH MainClassFileName
# or

$varnamejava -cp $YOURCLASSPATH MainClassFileName
     echo 'Successfully *****'
exit 0


Post a Comment

The Link Exchange - Your ultimate resource for link exchange!

About This Blog

  © Blogger template Webnolia by 2009

Back to TOP