Results 1 to 4 of 4
Thread: Launch Jar from in application
- 01-25-2011, 05:38 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 30
- Rep Power
- 0
Launch Jar from in application
Hi, I need to launch a jar, or use classes within the jar, whichever is easier, from within an application. Is there any way to do this? Basically I have one application that is a jar, and in that I need to run an executable jar that is located somewhere on the computer. If it is easier, I need to run the main for a class within that jar. Any help would be greatly appreciated.
- 01-25-2011, 05:40 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,606
- Rep Power
- 5
If you want to just run the jar as an external task, use Runtime.exec. If you need access to the classes in the jar, add the jar to your classpath.
- 01-25-2011, 05:57 AM #3
Member
- Join Date
- Jan 2011
- Posts
- 30
- Rep Power
- 0
I dont need to access the classes, its an executable jar, so runtime.exec will run that? if so what would be the code?
- 01-25-2011, 06:03 AM #4
Do you mean to say that you have got everything bundled inside the JAR file and you need to run that?
You can use the -jar command line option. Something like,
Java Code:java -jar jar-file
Make sure that your jar file contains the manifest file which has the application's entry point defined properly. Like,
where classname is the class file having the main method.Java Code:Main-Class: classname
Hope that helps,
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
Similar Threads
-
Not able to launch J2ME application
By vishal21 in forum CLDC and MIDPReplies: 2Last Post: 12-02-2010, 02:58 PM -
Not able to launch J2ME application
By vishal21 in forum Sun Java Wireless ToolkitReplies: 1Last Post: 11-23-2010, 01:14 AM -
Java Application fails to launch without error
By javaguy78 in forum AWT / SwingReplies: 9Last Post: 11-16-2010, 06:25 PM -
Launch Java application with root privileges from gnome desktop shortcut.
By IYIaster in forum New To JavaReplies: 1Last Post: 05-17-2010, 09:03 PM -
Passing screen resolution parameters at the launch time of the application!
By Y. Progammer in forum New To JavaReplies: 4Last Post: 03-12-2010, 05:57 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks