saplingPro
saplingPro

Reputation: 21329

packing the packages in a jar file with a manifest file

I have 4 packages each containing some .class files. There is one package that contains main class. How do i create a jar file packed with all the folders and the manifest file ?

I know the command jar cvfm MyJar.jar manifest.txt *.class , but i don't know the procedure to pack all the folders with their class files.

Here is the scene :

enter image description here

Also where shall i place the manifest file ?

Upvotes: 1

Views: 1564

Answers (2)

aviad
aviad

Reputation: 8278

Suppose your classes were in the package com.tst - go up one level in cmd (cd ..) and type the following : (use / on UNIX)

jar -cf myfile.jar .\com\tst\*\*.class

Now, if you have an existing JAR file, and want to extract it, you'd type the following

jar -xf myfile.jar

Manifest file can be used for specifying the jar version and classpath entries

Upvotes: 1

Stephan
Stephan

Reputation: 4443

The manifest needs to be placed in the META-INF directory.

Reference: Jar doc

Upvotes: 0

Related Questions