This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, How can I create an executable file in java, I've seen some programs that I have downloaded from the internet made in java that are ".jar" and you only double-click on it un runs. Can you give me some hints or any link wherer I can get some information on this issue? Many thanks,
Mario here's a quick easy lesson on creating executable jar files. Once you have created a jar file you must create a manifest file which has the folowing text:
Note the file has two lines. One with the main class and another blank line. Also my.package.MyMainClassName will be replaced with the fully qualified name of the class which contains your main method. Once you have created the file you can make an existing jar file executable by executing this at the command line:
jar -umf manifest Existing.jar
and to run it you will need to call
java -jar Existing.jar
Hope that was helpful.
Mario A. Villamizar
Joined: Mar 14, 2002
hi many thanks, that was really helpful. I created my executable jar file, but I got a new problem; I've got the following structure: The workspace is bin (folder)and inside this folder I've got the editor (folder) package and images(folder where there are all the images for the buttons). Inside the editor package is the JTEdi.class, which is the class that has the main method and as well some other packages. to create the jar file from the command line, I stand in the bin folder and type: jar cmf manifest.mf jtedi.jar editor images after that it created a jtedi.jar inside the bin folder and to run it I typed: java -jar jtedi.jar All that work just perfect, but if I put the jtedi.jar file in another folder and type from the command line the same java -jar jtedi.jar it works but it doesn't display the images on the buttons, intead (I'm using actions) it displays the description of the action. what could be the problem? Thanks again,
Well I am tryign teh same but while trying to Modify the jar i am getting this error, jar -ufm Application.jar manifest java.io.FileNotFoundException: manifest (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:103) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.tools.jar.Main.run(Main.java:164) at sun.tools.jar.Main.main(Main.java:904) tte manifest file is present so is the jar file... Whats wrong ??? :roll: Regards