File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes How War file generated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "How War file generated" Watch "How War file generated" New topic
Author

How War file generated

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

A war file doesn't know anything. You pick which files go into a war file when you create it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
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

Joined: Sep 10, 2009
Posts: 293
hi raghul , how the same war file generation in console .(you explained in command prompt)
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
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

Joined: Sep 10, 2009
Posts: 293
weblogic Administration console
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
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

Joined: Dec 01, 2007
Posts: 138

@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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Narender Reddy Soma
Greenhorn

Joined: Jun 05, 2010
Posts: 23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How War file generated