Java Programming - Running jar file

Hello all, i have application in which, on click of particular button needs to run a jar file.please help me out to fix this problem...Request RegardsAnil
[189 byte] By [anilrpa] at [2007-11-26 23:22:18]
# 1
http://java.sun.com/docs/books/tutorial/deployment/jar/
suparenoa at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 2

hello,

i dint get what i required on that URL.

i want system to run the jar file ,no manual cammands or instructions to run the

jar file

i tried with

 Runtime.getRuntime().exec(schpass); 

where schpass is a string for which a jar file is assigned ,

But that doesnot do for me.

i wonder is there any options to execute...

anilrpa at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 3
if you can run the jar file from the comand line and then copy that command in the batch file (run.bat). e.g java -jar abc.jarNow run this batch file from the application.
jawadhashmia at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 4

Try this,

Runtime.getRuntime().exec( "cmd /c C:\\jdk1.5.0_03\\bin<br clear="all" />javaw -classpath C:\\location_of_jar<br clear="all" />your_jar_file.jar; com.MainClassPackageAndName");

Remember to put the correct location of your JDK bin directory and jar directory and ur proper class path.

If your need to get the output streams of this jar then u'll need some more code, just give me a shout.

knightweba at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 5
Hey knightweb,Thanks for your valueable suggestion it worked for me....Cheers
anilrpa at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 6
Don't forget to give your Duke star to them who have helped you
Leelavathia at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...
# 7
Don't forget to give your Duke star to them who havehelped youvery sharp!!!
baskarka at 2007-7-10 14:27:16 > top of Java-index,Java Essentials,Java Programming...