Wednesday, October 27, 2010

Create jar, war & ear file

you can use the "jar" utility to create the jar, war & ear file.


To create a WAR  file -


Use the jar tool as follows :


jar -cvf myServletWAR.war .


This will create a war file myServletWAR.war with contents on current directory ( . at end of command )


jar -cvf myServletWAR.war myServlet


This will create a war file myServletWAR.war of directory myServlet.


To extract a war file 


jar -xvf myServletWAR.war



To create a JAR  file -


Use the jar tool as follows :

jar -cvf myServletWAR.jar .


This will create a jar file myServletWAR.jar with contents on current directory ( . at end of command )

jar -cvf myServletWAR.jar myServlet

This will create a jar file myServletWAR.jar of directory myServlet.


To extract a jar file 

jar -xvf myServletWAR.jar



To create a EAR  file -




Use the jar tool as follows :

jar -cvf myServletWAR.ear .

This will create a ear file myServletWAR.ear with contents on current directory ( . at end of command ) like war, jar files under current directory.




jar -cvf myServletWAR.ear myServlet




This will create a ear file myServletWAR.ear of directory myServlet.


To extract a ear file 

jar -xvf myServletWAR.ear

after that extract individual war or jar file

1 comment:

  1. It is great place to know about jar/war/ear creation and extraction.Thanks

    ReplyDelete