| Author |
how to make executable jar file
|
Sim Raina
Ranch Hand
Joined: Nov 20, 2003
Posts: 33
|
|
hi i am done with my program and i have only one class and i wanna make into an executabble file. can somebody tell me how to from the starting to the end process thanks in advance
|
if u can't impress people with ur intelligence , confuse them with ur bullshit
|
 |
Sim Raina
Ranch Hand
Joined: Nov 20, 2003
Posts: 33
|
|
|
ok now idone making the jar file and i can see it but when i run it , it can't find the main class , does anybody what king of problem isit?
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
Originally posted by Sim Raina: ok now idone making the jar file and i can see it but when i run it , it can't find the main class , does anybody what king of problem isit?
Does your jar contain a manifest file? How does it look like?
|
 |
Tom Blough
Ranch Hand
Joined: Jul 31, 2003
Posts: 263
|
|
Sim, within the jar file you need a file called MANIFEST. This file tells the JVM what class is the entry point. To do this, create a file named MANIFEST.MF in your working directory containing the following information: Where NameOfYourClass is the name of the class containing the entry point. Then include this file in your Jar with the following command: Where JarFile is the name of the jar file you wish to create. Hope this helps.
|
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
|
 |
Sim Raina
Ranch Hand
Joined: Nov 20, 2003
Posts: 33
|
|
i do have a mainfest file and then i did jar -cvfm myresult.jar mainfest.mf *.class and i did java -jar myresult.jar and it gives me this error C:\mysql\data\project>java -jar myresult.jar Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Message at readfileTest.main(readfileTest.java:6) all of my files are compliling and running i don't know what the problem is and this is the files i have in myresult.jar C:\mysql\data\project>jar -tf myresult.jar META-INF/ META-INF/MANIFEST.MF readfile.class readfileTest.class Testing.class and my manifest files looks like this ------------------------------ Manifest-Version: 1.0 Main-Class: readfileTest ------------------------------
|
 |
Sim Raina
Ranch Hand
Joined: Nov 20, 2003
Posts: 33
|
|
|
do u think it is because mail package is in the enterprise edition and it can't read it
|
 |
Ko Ko Naing
Ranch Hand
Joined: Jun 08, 2002
Posts: 3178
|
|
I think u forgot to include the jars needed for ur program in ur myresult jar. That's why ur class cannot find the package that it is calling from the main class... Just a suggestion...
|
Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
Sim: Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Message javax/mail/Message is a class normally packaged in mail.jar, and I believe you also need activation.jar. Since the classpath is ignored when you run the jar file, you will need to use the "Class-Path" attribute of the manifest file to point to your libraries. Something like this: Class-Path: libs\mail.jar libs\activation.jar<return> Note that the list of libraries is space-separated. Here is Jar File Specification
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
Many, or all, of these problems are covered in the creating an executable JAR thread.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: how to make executable jar file
|
|
|