STEVE00098
asked on
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.
Perhaps this should help (see at the bottom)
http://www.avajava.com/tutorials/lessons/how-do-i-create-a-war-file-using-the-jar-command.html
ASKER
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.
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
ASKER
As you suggested in the previous post I did set classpath=./;
ASKER
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
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.
Normally it just cannot find the executable.
ASKER
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
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
ASKER
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
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"
set JAVA_HOME="C:\Program Files\Java\jdk1.5.0"
ASKER
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
PATH
and send the result
Check the path:
echo %PATH%
or just simply say
PATH
and send the result
ASKER
C:\Program Files\Java\jdk1.5.0\bin>ec ho %path%
C:\WINDOWS\system32;C:\WIN DOWS;C:\WI NDOWS\Syst em32\Wbem; C:\WINDOWS \system32\ Wind
owsPowerShell\v1.0
C:\WINDOWS\system32;C:\WIN
owsPowerShell\v1.0
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sir,
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\Ap plication> 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 ...
ptions:
-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.
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\Ap
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 ...
ptions:
-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
ASKER
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
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:
http://stackoverflow.com/questions/1594667/war-vs-ear-file
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
ASKER
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.
God bless you and the world.
ASKER
very..Excellent
You are always welcome.
I very much appreciate your attitude.
I very much appreciate your attitude.
http://www.roseindia.net/jboss/buildingwebapplicationwithant.shtml
http://stackoverflow.com/questions/1267300/how-do-i-create-an-ear-file-with-an-ant-build-including-certain-files