This is a mere simple task but in order to actually do it, there is a tricky stuff to get it done. This article is simply written just to explain on how to actually change the project name in Netbeans. Before going into details, the explanation about Netbeans is actually quite simple. Itis an IDE built for developing Java Application at first, but it can be utilized for developing applications using several different programming language currently.
The problem for changing the project name in Netbeans occurred whenever there is an existing Java-based application project represented by a folder is going to be replaced by another source code of a Java-based application project. The sole purpose is just to update the source code because it doesn’t made by using any means of versioning tools such as SVN, CSV or Git.
After replacing the project’s folder, suddenly the name of the project including the webroot URL is changed. It happens because the properties of the project represented by the folder exists and the one which is being imported are totally different.
So, after importing the source to the existing folder, the following are steps taken in order to return the condition to the previous state. The following are the steps taken :
1. Change the webroot URL properties which can be found in the XML file of the project. It is located in the XML file exist in the WEB-INF folder of the project. Usually, it is generated if the project is created using an IDE such as Netbeans. The name of the XML file vary each other depends on the various things. But normally, it is called ‘web.xml’ or it contains ‘web’ as part of the file name. Below is the content of the web.xml file located in the WEB-INF folder primarily the part responsible for the URL part to be accessed via browser to execute the Java web Application :
<context-root>/webapp</context-root>
Change the string ‘webapp’ to whatever the project name will be.
- Change the line in the project.xml created by Netbeans. It is normally located inside the ‘nbproject’ folder. The line is shown as follows :
<name>webapp</name>
After that, try to close and reopen the project again. Normally, the name of the folder will be changed.