This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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>
Joined: Nov 20, 2003
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 ------------------------------
Joined: Nov 20, 2003
do u think it is because mail package is in the enterprise edition and it can't read it
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