Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use open a WAR folder in Netbeans

Tags:

java

jsp

netbeans

So I was given a WAR 'file', but upon downloading it I noticed that it is actually a folder, not a WAR file. Trying to open this folder in Netbeans is not working, because it is expecting a war file, not a folder.

I attempted "War-ing" the folder, which worked. Netbeans can now open the file, however none of the files can be edited.

like image 577
kz3 Avatar asked Dec 22 '11 22:12

kz3


2 Answers

This was tested using apache's ode.war in NetBeans 8.0:

  1. Unzip the war file
  2. In the unzipped folder, you will see WEB-INF/, META-INF/, etc., create a sub-folder named web in the unzipped folder.
  3. Put everything else into web (now they will be web/WEB-INF/, web/js/, ...)
  4. Go to netbeans, new project -> java web -> web application with existing sources
  5. Pretty much just press next all the way through. voilà, it's done.
like image 83
Vince L Avatar answered Oct 14 '22 07:10

Vince L


If you don't have eclipse handy, just place the war file into the webapps folder of Tomcat, go to the bin folder of Tomcat and run startup. Tomcat will automatically extract the war file for you. Now go to the webapps folder and you'll find another folder there, with the same name as your war.

I couldn't find an option to import a war directly into Netbeans (strange. Perhaps someone could create this feature and submit it as a patch to Netbeans). The folder which gets extracted into the Tomcat folder can be used as the Netbeans project. It's advisable to copy it to some other folder first. Import by File > New Project > Web application with existing sources.

Eclipse has an option to export a war and include the sources with it too, so there's a chance that the source files are in the war too.

like image 3
Nav Avatar answered Oct 14 '22 08:10

Nav