This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am playing around with creating a stand-alone JAR file, to be run like: java -jar hello.jar My jar file only contains:
Where the manifest was created automatically using: $ jar cvf hello.jar com/neil/Hello.class Now, running like: $ java -cp hello.jar com.nkl.Hello works But, I tried extracting the MANIFEST.MF file, and adding: Main-Class: com.neil.Hello Tyring to overwrite the MANIFEST.MF back into the jar file doesn't seem to work. The error I get is: $ jar umf hello.jar META-INF/MANIFEST.MF java.io.IOException: invalid header field at java.util.jar.Attributes.read(Attributes.java:354) at java.util.jar.Manifest.read(Manifest.java:161) at java.util.jar.Manifest.<init>(Manifest.java:56) at sun.tools.jar.Main.update(Main.java:487) at sun.tools.jar.Main.run(Main.java:168) at sun.tools.jar.Main.main(Main.java:904) Anyone point me to a good manifest ref? Thanks Neil [ September 13, 2002: Message edited by: Neil Laurance ]
Ok this is just some of the basics lets say you have a .class called helloworld and you are useing the jdk to put that class into a jar you would do something like this at the commandline jar cf aname.jar helloworld.class this would that class, note this class has the main()mothod in it. now let make that jar runnable and change the mainifest file We mak a txt file called mf.txt and we put this in there Manifest-Version: 1.0 Main-Class: myjar Name :myjar and save it now at the commandline we do this jar umf mf.txt aname.jar and this should change the mainfest file that was made by default for you and it should make your jar double clickable for windows
I made a bobo Where you see this Manifest-Version: 1.0 Main-Class: myjar Name :myjar where you see myjar it should be helloworld cause that would be your main class that has the main() method anyways see you around partner
Joined: Jul 18, 2002
Originally posted by Dirk Schreckmann: So, what does I sussed it. mean?
Its English slang for: I figured it out. I played around with the order of the arguments to the jar command, and got it to work