Hello All, I have this folder which holds my java class called apple, a text file called mainclass (which holds this: Main-Class: apple) and I have a jar file called apple aswell. when I go to run the jar file to see the output I get this error: C:\j21work\I>java -jar apple.jar Failed to load Main-Class manifest attribute from apple.jar what have I done wrong here why can I not get any output? Thanks Ben
I am a newbie with creating jar files, but I suspect that you need to change the name of mainclass to manifest. I think there is also a way to specify the file to use as the manifest file, but I'm not exactly sure. Alternatively, you can specify a class name to run explicitly when you use the java command. In this case, you could use: java -jar apple.jar Apple
To add a Manifest file, simply use this syntax: jar cvfm YourJar'sName.jar yourmanifesttextfile -C directorywithyourclassfiles/ if that works for you, use jar -tf YourJar'sName.jar to view the contents of the jar file Jason
Joined: Nov 08, 2002
Originally posted by Jason Fox: To add a Manifest file, simply use this syntax: jar cvfm YourJar'sName.jar yourmanifesttextfile -C directorywithyourclassfiles/ if that works for you, use jar -tf YourJar'sName.jar to view the contents of the jar file Jason
I done what you said and I keep getting this error: c:\j21work\I>jar cwfm apple.jar mainclass -c:\j21work\I\apple.class java.io.IOException: invalid header field
hi, Remember the extension of your manifest file must be .tmp and not .txt. manifest.tmp must contain the following text: Name: yourfilename.class Java-Bean: True now run the command jar cfm yourfilename.jar manifest.tmp yourfilename.class give the path of manifest file (instead of manifest.tmp) in case it is not in the same folder as your files are.