Results 1 to 7 of 7
- 05-13-2011, 03:29 AM #1
Senior Member
- Join Date
- Feb 2009
- Posts
- 182
- Rep Power
- 12
Trying to make a jar file double click/run from desktop
Hi, I am having trouble making an executable jar file that I can email someone and have them run it on their desktop. The app has a gui window that will pop up, very simple app.
I did this on the command line
jar cf PushCounter.jar Pushcounter.class PushCounterPanel.class <enter key>
and it made a jar , but when I double click it, it doesn't make the GUI popup window
then I tried jar cf PushCounter.jar * <enter key> to include all the files in the directory relating to the program and no good.
Any help would be great. thank you. Derek
I posted this also here Java applet won't display in firefox (Applets forum at JavaRanch)
- 05-13-2011, 03:35 AM #2
I have found making jar files a PITA. One thing I usually have problems with is the manifest file. Pointing out where you are going wrong over the net is nigh impossible as we are not there to see what you are doing. Are you reading a Jar tutorial? I suggest you read it and follow it very VERY carefully. If you skip or make a mistake in any of the steps the jar file will not be created correctly.
- 05-13-2011, 03:54 AM #3
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 10
Create a new text file named manifest. Put in the following:
Java Code:Main-Class: CLASSHERE
Now open command prompt, navigate to the directory of your class files and manifest file, and enter this:
Java Code:jar cvfm program.jar manifest.txt *.class
- 05-13-2011, 04:05 AM #4
Senior Member
- Join Date
- Feb 2009
- Posts
- 182
- Rep Power
- 12
edit I will try the above thanks
Ok I made the jar file with the manifest with the correct contents. But the jar doesn't run on the double click. Here is the message from the command line upon making the jar.
C:\JAVA_PROGRAMMING_CODE\code1\pushcounter>jar cvfm PushCounter.jar Manifest.txt
*.class
added manifest
adding: PushCounter.class(in = 657) (out= 431)(deflated 34%)
adding: PushCounterPanel$1.class(in = 199) (out= 152)(deflated 23%)
adding: PushCounterPanel$ButtonListener.class(in = 1084) (out= 572)(deflated 47%
)
adding: PushCounterPanel.class(in = 1527) (out= 790)(deflated 48%)
C:\JAVA_PROGRAMMING_CODE\code1\pushcounter>
Contents of my manifest are this below
Main-Class: PushCounterLast edited by silverglade; 05-13-2011 at 04:12 AM.
- 05-13-2011, 05:12 AM #5
Did you end the manifest with a blank line?
db
- 05-13-2011, 05:18 AM #6
Senior Member
- Join Date
- Feb 2009
- Posts
- 182
- Rep Power
- 12
Thank you. I just ended the manifest.txt with a few empty carriage returns to make a few blank lines. Saved it, and recompiled. Here is the log of what I did at the command prompt, thanks for helping. I want to get this running so bad LOL. It just won't run. Notice the "unable to load manifest info" when I even try to run it at command prompt.
C:\JAVA_PROGRAMMING_CODE\code1\pushcounter\classes >jar -cvmf manifest.txt PushCo
unter.jar *.class
added manifest
adding: PushCounter.class(in = 657) (out= 431)(deflated 34%)
adding: PushCounterPanel$1.class(in = 199) (out= 152)(deflated 23%)
adding: PushCounterPanel$ButtonListener.class(in = 1084) (out= 572)(deflated 47%
)
adding: PushCounterPanel.class(in = 1527) (out= 790)(deflated 48%)
C:\JAVA_PROGRAMMING_CODE\code1\pushcounter\classes >java -jar PushCounter.jar
Failed to load Main-Class manifest attribute from
PushCounter.jar
C:\JAVA_PROGRAMMING_CODE\code1\pushcounter\classes >
- 05-13-2011, 05:32 AM #7
Senior Member
- Join Date
- Feb 2009
- Posts
- 182
- Rep Power
- 12
Similar Threads
-
running jar file by double click
By Himanshu23 in forum AWT / SwingReplies: 0Last Post: 11-11-2010, 09:24 AM -
i created a jar file.but when i double click it doesnot work
By renu in forum New To JavaReplies: 1Last Post: 10-30-2010, 07:27 PM -
How to make Exe file of desktop application
By rakesh_n_mehta in forum AWT / SwingReplies: 1Last Post: 12-12-2009, 02:27 PM -
run java application from desktop with double click
By Rose88 in forum Advanced JavaReplies: 4Last Post: 09-29-2009, 07:32 PM -
Run Jar file on double click
By dhaval.rajput.p in forum New To JavaReplies: 2Last Post: 07-24-2009, 06:44 PM
Bookmarks