creating jar files

4 views
Skip to first unread message

sandeep kumar

unread,
Aug 18, 2010, 7:31:49 AM8/18/10
to iitdlug
what is the command to create a jar file from the java class files in
a subdirectory on my home
i tried jar cfe as mentioned in man pages and it creates the jar files
with out errors but running it shows that it cant find the main class
thanks

Narendra Sisodiya

unread,
Aug 18, 2010, 9:16:52 AM8/18/10
to iit...@googlegroups.com
Jar files are also zip files. simply zip will work. 

Khirod Patra

unread,
Aug 18, 2010, 3:59:45 PM8/18/10
to iit...@googlegroups.com
Java Archive (JAR) files are compressed files into which you can store many files. If you place the many classes that your application, or applet need in a JAR file, you reduce the size of your distributabels.

To create a JAR file, go to the directory where your files are located and type:
 
jar -cf test.jar *.*
 
Thank you
Khirod
 



--
Thanks & Regards

Khirod Chandra Patra
Direct Tel:9310041055
Email:khiro...@gmail.com
skype:khirod.patra

sandeep kumar

unread,
Aug 19, 2010, 12:28:47 AM8/19/10
to iit...@googlegroups.com
> To create a JAR file, go to the directory where your files are located and
> type:
>
> jar -cf test.jar *.*
i tried just as you mentioned
java test.jar indicated some class not found exception could not find
the main class
java -jar test.jar told me failed to load Main-Class manifest
attribute from test.jar
the folder in which i tried these has two classes J1.class and
J2.class and J1 is the main class
Reply all
Reply to author
Forward
0 new messages