Ask the Expert

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?

    Requires Free Membership to View

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:
http://java.sun.com/j2ee/sdk_1.3/techdocs/release/ToolsOnly.html

This was first published in November 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: