How can I create a war file of my project in NetBeans?
In Netbeans 7.4 - right click on the project select Properties-> Build -> Packaging. There you will see Compress WAR File.
You need to use -c switch of jar, to create the war file. Go inside the project directory of your project (outside the WEB-INF), then write the following command: jar -cvf projectname. war *
To deploy a WAR with NetBeans IDE, do the following: Select File->Open Project. In the Open Project dialog, navigate to your project and open it. In the Projects tab, right-click the project and select Undeploy and Deploy.
It's possible that you already have a war file and don't know it - netbeans does most of the work for you and I believe it creates a distributable war file by default. If you created a web project and successfully built it, it will be in the "dist" directory off your project root.
As DPA says, the easiest way to generate a war file of your project is through the IDE. Open the Files tab from your left hand panel, right click on the build.xml file and tell it what type of ant target you want to run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With