Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 .jar files
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Wed Sep 17, 2003 9:53 pm   Post subject: .jar files

and what kind of jam should I keep in them?

seriously though - are they some sord of .java compression files? Why do I have a bunch of classes under them in my project?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Thu Sep 18, 2003 3:06 pm   Post subject: (No subject)

JAR stands for Java ARchive. it really is a zip file, hence you can open it in winzip. but the special thing about jar is that not only is it used for archiving your java stuff but it is used for packaging your project. now when i say packaging in the jar context i'm not talking about java packages. packaging your project is like (but not really) creating an executable. that is your outcome is just one file.

to do that you will need to first create a manifest file with the Main-Class property set. then you create a jar package using that manifest file to archive all your class files.

now you can execute you project like this: java -jar myproject.jar
in GUI OSes you can also double click the jar file to execute it.

the JVM reads the contents of the jar file, look up the manifest file, and if it sees a Main-Class property set, it executes that class the property points to.

one hidden advantage the JAR file has is that it can be compressed using zip compression, and yet work as-is.
Tony




PostPosted: Thu Sep 18, 2003 5:26 pm   Post subject: (No subject)

thx rizzix

its just that I had couple of those .jar files in my compsci AP project and just wanted to figure out that they do Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
krishon




PostPosted: Thu Sep 18, 2003 9:21 pm   Post subject: (No subject)

lol...the only jar file i know is the tools.jar file for dr. java...shows how much i'm a :newbie:
rizzix




PostPosted: Thu Sep 25, 2003 7:34 pm   Post subject: (No subject)

no ur not u just like that emoticon heha very funny
krishon




PostPosted: Thu Sep 25, 2003 7:41 pm   Post subject: (No subject)

that's part of teh reason Very Happy
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: