Problem solve Get help with specific problems with your technologies, process and projects.

How can I keep jar and war files in an ear file to deploy to Weblogic server?

I have some jar and war files. I'd like to keep all of them in a ear file to deploy it to Weblogic server. What command should I use?

The J2EE SDK from Sun provides a command-line tool called "packager" that enables you to do just that. However, you should use any proprietary tools provided by your application server vendor if they are provided.

The "packager" will create all archives needed for J2EE deployment. In addition to .jar files, .war files and .ear files, "packager" can create EJB .jar files and resource adapter .rar files.

The file that is created by "packager" is controlled by command-line switches. For example, using "packager" at the command-line on a Unix-based platform, the following example stores resources into a .war file:

packager -webArchive -classpath . -classFiles

com/acmeinc/class1.class:com/acmeinc/class2.class:com/acmeinc/class3.class The following example stores resources into a .jar file:

packager -applicationClient classes packageA:Class1.class packageA.Main

appClient.xml appClient.jar The following example stores resources into a .ear file:

packager -enterpriseArchive web.war:ejb.jar:appClient.ear -libraryJars

util.jar appName app.ear A complete description of this tool can be found at:


Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.