Question

I have looked through the help documentation in netbeans 6.5.1 but cannot find anything explicit explaining how to deploy/import a war package.

I know in Eclipse, it's as easy as right clicking in the Project Explorer >> select IMPORT >> WAR FILE.

However, I still am unable to find a solution for Netbeans.

Thankyou, Jordan

Was it helpful?

Solution

I assume you don't already have an ant or maven project for your web project? If you did, you would just import a maven project or create a Web Free-Form Application and wire it up to your ant script.

I would unzip the war file, create a new web application with existing sources in netbeans and wire everything up using the wizard.

OTHER TIPS

posted elsewhere, thought i might post here too.

after some googling I've found the solution and here are the steps:

(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.
  1. Import the war project to eclipse.
  2. Then import the eclipse project to netbeans

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top