The manifest file tells jar which class file has the "Main-Class" directive to run. Note that this file needs to end with a new line character.
PS C:\Users\tjinkers\java\swing> ls Frame2.*
Directory: C:\Users\tjinkers\java\swing
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 22/01/2014 15:37 693 Frame2.class
-a--- 22/01/2014 10:20 377 Frame2.java
PS C:\Users\tjinkers\java\swing> cat .\manifest.txt
Main-Class: Frame2
PS C:\Users\tjinkers\java\swing> jar cvfm Frame2.jar manifest.txt Frame2.class
added manifest
adding: Frame2.class(in = 693) (out= 471)(deflated 32%)
PS C:\Users\tjinkers\java\swing> ls Frame2.*
Directory: C:\Users\tjinkers\java\swing
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 22/01/2014 15:37 693 Frame2.class
-a--- 22/01/2014 17:04 948 Frame2.jar
-a--- 22/01/2014 10:20 377 Frame2.java
PS C:\Users\tjinkers\java\swing> ./Frame2.jar
PS C:\Users\tjinkers\java\swing>
No comments:
Post a Comment