aspose file tools*
The moose likes Beginning Java and the fly likes Executable Jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Executable Jar File" Watch "Executable Jar File" New topic
Author

Executable Jar File

deepak kukreja
Ranch Hand

Joined: Aug 13, 2001
Posts: 54
Hi
Firat of all I want to ask what is the use of
making executable jar files.
Suppose 'm having two simple class files A.class and B.class
in E:\Files. I created one jar file with both of them.
I know that i have to update the Manifest file. I want to
ask what is to be written in that file for this particular case.
One more thing as these are simple class files, with no GUI,
even if I click on jar file>>>nothingwill happen >>i quess so.
Suppose I want to make an executable jar file say For
HelloWorld applet. Then which files i have to add into manifest file.
In jar file i will be having one class file for applet and one html file.


Deepak<br />SCJP
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
I don't (yet) know much about how to build jar-files , but I know that rather than clicking on it to call, you should call it by entering this into the command line:
java -jar YourJarProgram.jar

as far as I know this goes for both OS: Windows (on the DOS-Prompt) and Linux.
[ June 21, 2003: Message edited by: juliane gross ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
You might want to take a look at the executable JAR file tutorial thread, found through a quick search on this forum. (The search page link is at the top right of this page.)
If the OS environment is properly configured and the JAR file is made correctly, it should be executable with a simple double-click.
One more thing as these are simple class files, with no GUI,
even if I click on jar file>>>nothingwill happen >>i quess so.

If the program simply displays text to the console, then you're right, double-clicking on the executable JAR may result in not much happening. With Windows, the OS is configured to run the JAR with javaw.exe, which runs a Java program much like java.exe does, except the console isn't displayed.
Suppose I want to make an executable jar file say For HelloWorld applet.
You cannot easily make an executable Applet, per se. You could write a Java program that could view a web page (i.e. a web browser) and is configured to open the page with the Applet you have. Or you could use the Applet as a Panel, and just add it to a Frame.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
deepak kukreja
Ranch Hand

Joined: Aug 13, 2001
Posts: 54
hi Dirk
I got it working from console.
but there is one problem. When i double click on
jar file, wiz-zip opens.
How should i prevent it from win-zip.
Deepak
deepak kukreja
Ranch Hand

Joined: Aug 13, 2001
Posts: 54
hi Dirk
I got it working from console.
but there is one problem. When i double click on
jar file, wiz-zip opens.
How should i prevent it from win-zip.
Deepak
 
Don't get me started about those stupid light bulbs.
 
subject: Executable Jar File