7

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.

Stanley Mungai
  • 4,044
  • 30
  • 100
  • 168

1 Answers1

14

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.

Marc de Verdelhan
  • 2,501
  • 3
  • 21
  • 40
  • great, but be aware: all the imports with the asterisc in the same project will not be converted in netbeans – deldev Feb 03 '17 at 13:36