Author |
Message |
jin
|
Posted: Thu May 25, 2006 10:50 pm Post subject: Need Help making Jar File |
|
|
Hey i'm trying to make a program of mine into a jar file. i have tried the jarmaker and it did no work.
Here are the files in the folder:
Gas_Station.java
Gas_Station.class
Gas_Station$1.class
Gas_Station$ButtonHandler.class
Gas_Station$CheckBoxHandler.class
Gas_Station$RadioButtonHandler.class
Gas_Station$TextFieldHandler.class
And the Manifest i made is "Manifest.txt" also in the same folder and its contents are:
Manifest-Version: 1.0
Created-By: 1.5.0_01 (Sun Microsystems Inc.)
Main-Class: Gas_Station
Class-Path: C:\Documents and Settings\Jin\Desktop\Gdr\Semester 2\Computer Science\Unit 1
And there is also the empty line after the class path.
THANKS. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
[Gandalf]
|
Posted: Thu May 25, 2006 11:22 pm Post subject: (No subject) |
|
|
You'll have to be a bit more specific, are you trying to create a normal java archive (.jar) or are you trying to make out self-executable? Either way, you can get some help by typing "jar --help" in command prompt, and using that to create your archives. |
|
|
|
|
|
jin
|
Posted: Fri May 26, 2006 3:20 pm Post subject: (No subject) |
|
|
i am trying to make a self-executable. and i tried "jar --help" and it did not work. |
|
|
|
|
|
jin
|
Posted: Fri May 26, 2006 3:21 pm Post subject: (No subject) |
|
|
i am trying to make a self-executable. and i tried "jar --help" and it did not work. it said:
"jar" is not recognized as an internal or external command, operable program or batch file. |
|
|
|
|
|
jin
|
Posted: Fri May 26, 2006 5:45 pm Post subject: (No subject) |
|
|
jar -help worked and i can make the jar file but when i try to execute it by double clicking i get an error:
Could not find the main class. Program will exit. |
|
|
|
|
|
[Gandalf]
|
Posted: Sat May 27, 2006 11:55 am Post subject: (No subject) |
|
|
So you should have said that you wanted to create a self-executing jar file. In this case you would need to include a MANIFEST.MF file inside a folder called META-INF. Some sample data for MANIFEST.MF would include:
Quote: Manifest-Version: 1.0
Main-Class: ChessGame
Did you keep the quotes when you typed in "jar --help"? Generally when you put quotes around something you don't leave them in when you copy it for your own purposes, like if I said the title of this topic is "Need Help making Jar File". The real title doesn't have those quotes.
Also, please avoid triple posting. Your first two posts were within one minute of each other. In the future, before you make a post think of everything you want to say first. |
|
|
|
|
|
jin
|
Posted: Sat May 27, 2006 1:35 pm Post subject: (No subject) |
|
|
Thanks a lot Gandalf. It works now. And no i did not put the quotes in. And sorry bout the double posting. |
|
|
|
|
|
jin
|
Posted: Sat May 27, 2006 2:50 pm Post subject: (No subject) |
|
|
Sorry bout this. i was trying making other programs to jar also and it worked but then i came across a program of mine which has a superclass that it refers to. i tried making a jar and it was made but nothing would happen when i tried to execute it.
is there something else that i have to add to the manifest or is there a different cmd command?
P.S. this program also has pictures and music associated with it. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
[Gandalf]
|
Posted: Sat May 27, 2006 4:29 pm Post subject: (No subject) |
|
|
Unless the class is included with Java, or you have added it to the includes folder, you will need to add it to your jar file. Same goes for any images, sounds, videos, text, or any other files you are using in your program. |
|
|
|
|
|
jin
|
Posted: Sat May 27, 2006 8:15 pm Post subject: (No subject) |
|
|
i removed the images and music to see if it made a difference but it did not. Even after adding both files to the jar it still does not work; nothing happens after i double click.
Here are the files in the META-INF folder:
Lottery_Program.java
Lottery_Program.class
Lottery_Program$1.class
Lottery_Program$ButtonHandler.class
Superclass.java
Superclass.class
MANIFEST.MF
and these are all the files i added to the jar file.
The manifest is like the one u said to make with just the version and main-class and the empty line.
The lottery_program is main and calls upon the superclass.
If u would like to see any or all of these files let me know.
thnx |
|
|
|
|
|
|