Click to See Complete Forum and Search --> : jar file


wang shao
September 20th, 2000, 12:44 PM
Hi,
if I have three java classes like:
(1)
package com.1
import com.2
import com.3
class c1{....}
(2)
package com.2
import com.1
import com.3
class c2{....}
(3)
package com.3
import com.1
import com.2
class c3{....}
my problem is that how I can compile them and jar them and use them?
Thanks in advance

Phill
September 21st, 2000, 05:19 AM
Ni how ma?

You can make a manifest file, by typing the following :

Manifest-Version: 1.0
Main-Class: yourClassName.class

The Main-Class attribute is the class that you
have the main method in, if this class is
in your com.1 package and its name is "MyClass"
then your Main-Class line would look like this:

Main-Class: com.1.MyClass

after adding these two lines to a new file
save this file as
"MANIFEST.MF"
make sure you use the quotation marks.
Then put that file with all of your .java files
Now go to the command line (dos)
and type

jar cmf MANIFEST.MF YourJar.jar com


a jar file will appear with the everything
inside it, then you can run it
with the following:

java -jar YourJar.jar

Good Luck
Phill