patelajk
asked on
Trying to use jar. Getting 'no such file or directory' error
I'm trying to jar some classes in a directory using the command:-
jar cvfmM Sketcher.jar Sketcher.mf -C *.class
My manifest file is as follows:-
Manifest-Version: 1.0
Main-Class: Sketcher
Created-By: Squills
When I try to jar the classes I get the error 'Constants.class\scaleSlid er2.class : no such file or directory'
Any help would be most appreciated
jar cvfmM Sketcher.jar Sketcher.mf -C *.class
My manifest file is as follows:-
Manifest-Version: 1.0
Main-Class: Sketcher
Created-By: Squills
When I try to jar the classes I get the error 'Constants.class\scaleSlid
Any help would be most appreciated
Hi patelajk,
Its not able to find the class files.
after -C, you need to specify the directory name, where the .class files are present.
Cheers!
Its not able to find the class files.
after -C, you need to specify the directory name, where the .class files are present.
Cheers!
(assuming class files are in current directory)
I *think* you may need the "-" with Windows:
jar -cvfm Sketcher.jar Sketcher.mf *.class
Tim
jar -cvfm Sketcher.jar Sketcher.mf *.class
Tim
No ;-)
hehhe...ok... sorry ;-) ignore me ;-)
ASKER
My class files are in the current directory.
I tried:-
jar cvfm Sketcher.jar Sketcher.mf *.class (ie without the M flag)
This produced :-
java.io.IOException: invalid header field
at java.util.jar.Attributes.r ead(Attrib utes.java: 387)
at java.util.jar.Manifest.rea d(Manifest .java:167)
at java.util.jar.Manifest.<in it>(Manife st.java:52 )
at sun.tools.jar.Main.run(Mai n.java:124 )
at sun.tools.jar.Main.main(Ma in.java:90 4)
The same happened with 'jar -cvfm Sketcher.jar Sketcher.mf *.class'
I can get 'jar cvfmM Sketcher.jar Sketcher.mf *.class' to produce a jar file now without errors but when I try to run the jar file it is corrupt or invalid.
I tried:-
jar cvfm Sketcher.jar Sketcher.mf *.class (ie without the M flag)
This produced :-
java.io.IOException: invalid header field
at java.util.jar.Attributes.r
at java.util.jar.Manifest.rea
at java.util.jar.Manifest.<in
at sun.tools.jar.Main.run(Mai
at sun.tools.jar.Main.main(Ma
The same happened with 'jar -cvfm Sketcher.jar Sketcher.mf *.class'
I can get 'jar cvfmM Sketcher.jar Sketcher.mf *.class' to produce a jar file now without errors but when I try to run the jar file it is corrupt or invalid.
ASKER
I've saved my manifest file in Unicode format and left a blank line at the end of it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's the ticket!
Thanks CEHJ.
Thanks CEHJ.
:-)
jar cvfm Sketcher.jar Sketcher.mf *.class