running the java utility from unix shell script

Hi experts,
               i have an issue with running a java file from a unix shell script. The java file i am running is part of a jar file. The java file takes 2 args. The windows equivalent to what i wud like to achieve is the following :

C:\Program Files\Java\jre1.5.0_13\bin\java.exe  -cp C:\Util.jar; com/util/Deploy Arg1 Arg2

Where C:\Utill.jar is the jar file which contains the class Deploy which takes 2 args.

Please help me achieve the same in shell script on unix ..

thanks in advance
Who is Participating?
bhaskar20001Connect With a Mentor Commented:
windows:: java  -cp c:\Util.jar com.util.Deploy %1 %2
Unix/Linux:: java  -cp /path/Util.jar com.util.Deploy $1 $2

The command is +- the some

java  -cp /path/Util.jar com/util/Deploy Arg1 Arg2

in my pc the Java is in:
Three observations:

1). Under Unix/Linux the semi-colon is and end-of-command marker. To separate multiple paths in the classpath use colon.

2). Both previous examples have a syntax error if the class is named Deploy and is in the package com.util. The correct unix command line is:

java  -cp /path/Util.jar com.util.Deploy Arg1 Arg2

3). If you define Deploy as the main class within the manifest file, you can simplify things even more:

java  -jar /path/Util.jar Arg1 Arg2
All Courses

From novice to tech pro — start learning today.