Solved

Create war and ear

Posted on 2011-03-23
25
1,258 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:STEVE00098
  • 12
  • 11
  • 2
25 Comments
 
LVL 92

Expert Comment

by:objects
ID: 35202868
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35202873
0
 

Author Comment

by:STEVE00098
ID: 35203564
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.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203586
Well, I guess you still don't have jre in the PATH
0
 
LVL 92

Expert Comment

by:objects
ID: 35203594
sounds like you didn't tick the install JRE option when installing the jdk
0
 

Author Comment

by:STEVE00098
ID: 35203613
As you suggested in the previous post I did set classpath=./;
0
 

Author Comment

by:STEVE00098
ID: 35203623
JRE is installed I verified from the control panel and issing command java -version is that the not right way to verify please advise
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203630
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
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203635
can you run javac
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203644
This is a bit strange message - No public JRE - ?
Normally it just cannot find the executable.
0
 

Author Comment

by:STEVE00098
ID: 35203673
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
0
 

Author Comment

by:STEVE00098
ID: 35203698
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.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 47

Expert Comment

by:for_yan
ID: 35203714
Is your directory which you listed in the PATH.
Check the PATH in the same dos window where you are running the jar command
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203719
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"

0
 

Author Comment

by:STEVE00098
ID: 35203736
tried but no help, could you please send me the command i will copy and paste
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203744
Which command  you mean?
Check the path:

echo %PATH%

or just simply say

PATH

and send the result

0
 

Author Comment

by:STEVE00098
ID: 35203752
C:\Program Files\Java\jdk1.5.0\bin>echo %path%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\Wind
owsPowerShell\v1.0
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 35203799
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



0
 

Author Comment

by:STEVE00098
ID: 35203828
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\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 ...
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.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35203866
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
0
 

Author Comment

by:STEVE00098
ID: 35203892
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
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35204003

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



0
 

Author Comment

by:STEVE00098
ID: 35204171
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.
0
 

Author Closing Comment

by:STEVE00098
ID: 35204174
very..Excellent
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35204178
You are always welcome.
I very much appreciate your attitude.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now