• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How War file generated

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How war file knows , where and which class files to pick up and generate war file.
I mean how war file knows to pick corresponding files.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A war file doesn't know anything. You pick which files go into a war file when you create it.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajendra,

Yes, war file does not know anything, It takes related information from the command you have provided during war file creation...

e.g. consider there is an application with name myApp available in 'C:\' then the command to create the war file is something like this:

C:\myApp> jar -cvf myApp.war *.class

Here is the answer to your question where and which class files to pick up and generate war file:

1. Where : From the command line path 'C:\myApp', it will find the files to pick.
2. Which : the '*.class' part in command which indicates that pick up class files which is available in C:\myApp directory.

Please let us this is what you want to know.

Thanks

Rahul


 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi raghul , how the same war file generation in console .(you explained in command prompt)
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul wrote:
C:\myApp> jar -cvf myApp.war *.class


Though this will generate a .war file it is not as per the directory structure required for a WAR file as per specification. The class files will be present in the root of the war which are supposed to be present in WEB-INF/classes


Rajendra wrote
hi raghul , how the same war file generation in console .(you explained in command prompt)


Which console?
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
weblogic Administration console
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not too sure of weblogic console but i havent come across any such utility in the other application server's console, i doubt if you will find one. Logically a console is used to deploy an application and not generate one to be deployed.
However if you find this Command prompt approach to be tedious you can use ant to build your app.

If you still want one simpler approach specific to your test projects, why not have a bat file prepared to build the war file.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

@Amol: This is a just an example for explanation purpose, for the asked question. In case you want to retains the whole directory structure then you may use '*.*' instead of *.class file pattern.

@Rajendra: I have mentioned word command prompt (cmd) on windows XP. if you have any difficulty for generating war file using the command then you may use an eclipse or any other IDE for the same.

Thanks,

Rahul
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "the console" most people will assume that you mean the shell or command line interface to the operating system.
If you're looking for help that is specific to WebLogic, your best bet would be to post your question in our BEA Weblogic forum. If you aren't going to do that and post instead to a more generic forum like "Servlets" it would be a good idea to mention that you are looking for a Weblogic specific solution in your first post.

 
Narender Reddy Soma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajendra Prakash wrote:weblogic Administration console


Is there any specific reason you want to create war file using weblogic console?

if you have option to go with other idea's .

Check out war ANT task or equivalent in Maven etc.

Weblogic console can identify a war file(arhived/exploded) after you created it. But I think it cannot help you creating war file since it cannot know what files should be included in your specific application.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic