Results 1 to 3 of 3
Thread: how to execute a jar file
- 02-03-2011, 03:18 PM #1
Senior Member
- Join Date
- May 2010
- Posts
- 113
- Rep Power
- 0
how to execute a jar file
Hi
I have written java code using eclipse , this java code has a jdbc connection and classes12.jar has been added to the program and a jar file has been created .
Now when i try to run the jar file , it does not run . So i created a bat file with the path of the jar file in it and kept the jar file , bat file and classes12.jar file in that folder and tried running the bat file , it is running.
My question , is does the classes12.jar file should be added to the folder again to execute the bat file ?
and also how can i achieve running the jar file , without using the bat file ?
- 02-03-2011, 04:05 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Do you have a Manifest in the jar file?
Inside that manifest it should say what the main class is, as well as any dependent libraries (ie jar files).
The classes12.jar isn't in you jar file is it? You can't stick jars in jars like that.
- 02-03-2011, 04:09 PM #3
when you create a jar from eclipse that contains more classes before you click the finish button in the wizard make sure you have select the class the contains the method main(). after that go to the directory where the jar has been exported and enter
jar -jar JarName.jar
and the jar should start.Last edited by j2me64; 02-03-2011 at 04:14 PM.
Similar Threads
-
How to execute a class in a subdirectory in .jar file
By zeyarag in forum New To JavaReplies: 2Last Post: 11-23-2010, 05:49 PM -
jar file won't execute.
By Splat in forum New To JavaReplies: 5Last Post: 10-22-2009, 05:26 AM -
Execute external file/program
By sirwiggles in forum New To JavaReplies: 3Last Post: 04-21-2009, 11:35 PM -
execute on server and read from file
By futurpc in forum NetworkingReplies: 1Last Post: 03-13-2009, 07:45 PM -
Execute Jar file
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks