Is it possible to create a new parent folder inside the src folder using eclipse?

51 Views Asked by At

I have my project & folder structure set up. I'm currently adding to this and it's getting a little bit complicated. I want to move my folders inside the src folder which currently look like:

src
...dog
...cat
...car
...motorbike
...tree

I would like to create a new folder inside the src folder and have it looking something like:

src
...animals
......dog
......cat
...vehicles
......cars
......motorbike
...nature
......tree

I have tried creating a new package & folder inside src folder, but when I try to refactor/move the folders, I'm getting an error saying a 'a package cannot be moved to it's own parent'

1

There are 1 best solutions below

0
David Weber On

Yes you can. Just create new packages in your src/main/java folder.

You can create structures Like:

src
   animals
     Dog
     Cat
   vehicles
     fourwheeled
       Car
       Pickup
     twowheeled
       EBike
       Bike

Switch your package representation of your explorer to hierarchical and drag and drop the packages. In this view you can create packages easily at the correct location. Just remember to check that the package paths are correct while refactoring.