[java-dev] Re: Running a Jar executable
Adam Murray
adamjmurray at gmail.com
Mon Feb 4 18:09:50 MST 2008
- Previous message: [java-dev] Running a Jar executable
- Next message: [java-dev] Re: Running a Jar executable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Quote: Benjamin wrote on Fri, 01 February 2008 19:53 ---------------------------------------------------- > I have looked around the forum and I could not really find this. I need a way to open a jar executable (a simple swing app) . For instance. I want just a simple class which extends MaxObject (obviously) that has one "bang" input which opens up a jar executable of a swing java application I wrote. Should I try to use something like Runtime.exec()? Also, I have written small swing interfaces using Max before and I remember having to use SwingUtilities.invokeLater(), will I have to incorporate this as well. ---------------------------------------------------- Hi Benjamin, Yes, you could do Runtime.exec(). But if you have a jar file, why not add it to the Max classpath and call into the code directly from your MaxObject? You should be able to call the main() method of the main class. If you are not sure which is the main class, unzip the jar, find its manifest file, and look for the "Main-Class" setting. If you really want/need to exec the jar, you could use one of the shell objects (search for "shell" on maxobjects.com) instead of making your own object to do the exec. I haven't coded in Swing in a while, but I believe you should always use invokeLater or invokeAndWait. Sun's tutorials have more info: http://java.sun.com/docs/books/tutorial/uiswing/concurrency/initial.html You only need to worry about this for the actual Swing code, not the exec call. -Adam
- Previous message: [java-dev] Running a Jar executable
- Next message: [java-dev] Re: Running a Jar executable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
