Create war and ear

What would be The eaisest way to create a war file and ear file using cmd prompt.  I have a folder with JSP , configuration and jar file. How can i create a war and ear file. Please advise.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

for_yanConnect With a Mentor Commented:
So you don't have java in your PATH.
How do you say it runs javac ?

Go to Contrl Panel --> System -->Advanced -->Envirobnemnt Variables-->

and edit PATH
putiing this C:\Program Files\Java\jdk1.5.0\bin
in the beginning
then open new window and try jar
without arguments

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

STEVE00098Author Commented:
After cd to this folder D:\JDE\Application, I try to create jar and i get the below error message, what could be the reason.

Thank you

D:\JDE\Application>jar -cvf Application.war
No public JRE.
Well, I guess you still don't have jre in the PATH
sounds like you didn't tick the install JRE option when installing the jdk
STEVE00098Author Commented:
As you suggested in the previous post I did set classpath=./;
STEVE00098Author Commented:
JRE is installed I verified from the control panel and issing command java -version is that the not right way to verify please advise
You can check your PATH and find java bin folder and check if you have jar there.

Actually I think I have jar.exe with JDK not JRE
can you run javac
This is a bit strange message - No public JRE - ?
Normally it just cannot find the executable.
STEVE00098Author Commented:
Yes I can
Directory of C:\Program Files\Java\jdk1.5.0\bin

3/23/2011  06:34 PM    <DIR>          .
3/23/2011  06:34 PM    <DIR>          ..
3/23/2011  06:29 PM            49,271 appletviewer.exe
3/23/2011  06:29 PM            49,260 apt.exe
3/23/2011  06:29 PM            36,972 beanreg.dll
3/23/2011  06:29 PM            49,269 extcheck.exe
3/23/2011  06:29 PM            20,480 HtmlConverter.exe
3/23/2011  06:29 PM            49,271 idlj.exe
3/23/2011  06:29 PM            49,252 jar.exe
3/23/2011  06:29 PM            49,273 jarsigner.exe
3/23/2011  06:30 PM            49,245 java.exe
3/23/2011  06:30 PM            49,266 javac.exe
3/23/2011  06:30 PM            49,272 javadoc.exe
3/23/2011  06:30 PM            49,266 javah.exe
3/23/2011  06:30 PM            49,262 javap.exe
3/23/2011  06:30 PM            49,247 javaw.exe
3/23/2011  06:30 PM           127,075 javaws.exe
3/23/2011  06:30 PM            49,271 jconsole.exe
3/23/2011  06:30 PM            49,275 jdb.exe
3/23/2011  06:30 PM            49,256 jps.exe
3/23/2011  06:30 PM            49,262 jstat.exe
3/23/2011  06:30 PM            49,265 jstatd.exe
3/23/2011  06:30 PM            49,269 keytool.exe
3/23/2011  06:30 PM            49,265 kinit.exe
3/23/2011  06:30 PM            49,265 klist.exe
3/23/2011  06:30 PM            49,263 ktab.exe
3/23/2011  06:30 PM            49,283 native2ascii.exe
3/23/2011  06:30 PM            53,380 orbd.exe
3/23/2011  06:30 PM            49,277 pack200.exe
3/23/2011  06:30 PM            69,742 packager.exe
3/23/2011  06:30 PM            49,275 policytool.exe
3/23/2011  06:30 PM            49,257 rmic.exe
3/23/2011  06:30 PM            49,263 rmid.exe
3/23/2011  06:30 PM            49,275 rmiregistry.exe
3/23/2011  06:30 PM            49,274 serialver.exe
3/23/2011  06:30 PM            49,296 servertool.exe
3/23/2011  06:30 PM            53,389 tnameserv.exe
3/23/2011  06:30 PM           127,098 unpack200.exe
STEVE00098Author Commented:
I have a folder with jsp and configuration files, all I am trying to do is create a ear or war file. Preferably ear file to deploy to webspehere.
Is your directory which you listed in the PATH.
Check the PATH in the same dos window where you are running the jar command
Also try to set JAVA_HOME to C:\Program Files\Java\jdk1.5.0\bin although it does not matter normally, still try in the same window

set JAVA_HOME="C:\Program Files\Java\jdk1.5.0"

STEVE00098Author Commented:
tried but no help, could you please send me the command i will copy and paste
Which command  you mean?
Check the path:

echo %PATH%

or just simply say


and send the result

STEVE00098Author Commented:
C:\Program Files\Java\jdk1.5.0\bin>echo %path%
STEVE00098Author Commented:
I added the path as you suggested , now I get different error ..i hope we are very close to solve this problem you are real genius

C:\Program Files\Java\jdk1.5.0\bin\Application>jar -cvf Application.war

All I am trying to create a ear file or war file of Application directory

c' flag requires that input files be specified!
sage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...
   -c  create new archive
   -t  list table of contents for archive
   -x  extract named (or all) files from archive
   -u  update existing archive
   -v  generate verbose output on standard output
   -f  specify archive file name
   -m  include manifest information from specified manifest file
   -0  store only; use no ZIP compression
   -M  do not create a manifest file for the entries
   -i  generate index information for the specified jar files
   -C  change to the specified directory and include the following file
f any file is a directory then it is processed recursively.
he manifest file name and the archive file name needs to be specified
n the same order the 'm' and 'f' flags are specified.
You need to be in the same folder where you have your struff amnd you need to piut dot after the war namer check the blac0k window picture in the link which I sent you
STEVE00098Author Commented:
Thank  you created the War file. from the bottom of my heart..thank you. Last question how do I create ear file from this war file.

Thank you and have a happy night

WAR file contains web application deployable in J2EE/JEE application server

EAR contains WAR and EJB. If you don't have EJB in your application
you do not need to have EAR file. You just deploy your application as WAR file.

See description:

If you are using application server which supports EJB - say Weblogic,
they have interface which creates EAR files for you.

If you are deploying your Web applications (containing html, jsp, servlet classes)
say in Tomcat, you don't need to create EAR files

STEVE00098Author Commented:
Thank you sir. I deployed the war file successfully. It's working like a charm. And a very BIG thank you to you. People like you really make a big difference in others life. Glad that you are here..keep up teh \very good work.

God bless you and the world.
STEVE00098Author Commented:
You are always welcome.
I very much appreciate your attitude.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.