dcsimg
JARS
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, July 12, 2002 01:55 PM

I've never created a JAR before, but I've seen them done and look like the only way of mimicking an executable file. Can anyone tell me what a jar does and how to make one? an executable one preferrably.
Thanks.

Re: JARS

Posted By:   Simone_Re  
Posted On:   Friday, July 12, 2002 03:19 PM

A jar file is an archive of classes and other resources as images, clips and so on.

Jars are generally used to store in a group all the classes belonging to a package or more packages of the same technology. (There are jars for XML, mail, jdbc managing and so on).

If you want to create your jar for storing all your classes, you must use the "jar" program included in the JDK.



jar cvf archive_name.jar *.class

This is the syntax to create a new jar (named archive_name.jar) and store in it all the classes in the current directory.

Once created, the jar is usually included in the CLASSPATH of the executing environment so all the classes are available.

A class with a main method included in a jar needs however the java interpreter for execution. It isn't a stand-alone executable.



jar tvf archive_name.jar

shows all the content of the jar "archive_name.jar"
About | Sitemap | Contact