I Know this seems absurd to ask but I can't seem to get around renaming a package in Netbeans that Have sub-packages. ideally when I right-click and refactor > Rename it renames only the node on the Top. If I try to refactor the Next Node in Line, I get the Error that :
Package already Exists
Does anyone knows how i should go about renaming my main package containing other packages and sub-packages in Netbeans? I am using netbeans 7.2.1.
In the Project Explorer, right click the package name and choose Refactor->Rename.
Right-click the package you want to move, and select " Refactor/Rename..." -- NOT " Move "! Modify the name of the package to reflect its desired new position in the package hierarchy, e.g.
To rename a variable, method or class name, consider the following steps: Click right on the variable/method/class name and select "Rename" from the Refactor menu.
Using Netbeans 7.3 and assuming your project has the following structure:
my.package.test.subpackage1
my.package.test.subpackage2
my.package.test.subpackage3
You want to rename test
into tests
.
Go to the NetBeans Files
window (Ctrl + 2
or using the Window -> Files
menu). Left-click on the folder corresponding to the package you want to rename (i.e. test
).
Type F2
and rename it.
All the sub-packages should have been moved to the new directory and all the related package
and import
statements should have been updated.
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