Hello all

I have classes all bundled in a package
The name of the package is components
All the classes placed in a directory c:\LJava\build\components
The names of the clases are a.class b.class and c.class

How to jar this package ?
I use dos prompt(not net beans)
main class is in a.class

thank you


Recommended Answers

I last used this command:

jar -cfm XCellTrack.jar C:\science\java\XCellTrack\meta-inf\Manifest.mf *.class
Jump to Post

All 8 Replies

I have tried to follow the tutorial
I try with simple HelloWorld.class inside package HelloWorld

but it seem not working ,alway error
Invalid header field
I have changed the position between the manifest
and the HelloWorld.jar ,but still
Invalid header field
after creating text file manifest with content
jar -cfm manifest.txt HelloWorld.jar HelloWorld\*.class

but still Invalid header field

any help ?

thank you

My problem is
I cannot replace the manifest with the right one
there are only two lines inside the manifest files
without the Main-Class: classname
if working with code without package i was success.
I can change the manifest easily
But never success if the code inside a package

thank you


I last used this command:

jar -cfm XCellTrack.jar C:\science\java\XCellTrack\meta-inf\Manifest.mf *.class

hello all
still the same:

C:\LJava\build\Dunia>jar -cfm HelloDunia.jar c:\LJava\test1\META-INF\MANIFEST.MF
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:410)


My code run well when I type :
C:\LJava>java -cp .\build Dunia.HelloDunia
Hello Dunia

and the file MANIFEST.MF is in c:\LJava\test1\META-INF

thank you



jar -cf name.jar file1.java file2.java
//create jar

the file1.java, file 2.java will be in name .jar after executing above command

hello thines01 and mHulk

thank for your help


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.