Moving packages eclipse

后端 未结 6 1256
萌比男神i
萌比男神i 2021-01-01 08:57

Maybe a stupid question but I have two packages in eclipse and now I would like to move the one package into the other for better structure.

Now I tried move but tha

6条回答
  •  Happy的楠姐
    2021-01-01 09:34

    This is slightly non-intuitive, but the best way to do it is by right clicking on the package you wish to move, clicking on refactor, and then on rename.

    Then proceed to enter the fully qualified path which you desire.

    For example, if you wish that a package called dog be moved into a package called mammals which itself is in a package called animals you would essentially rename your dog package to animals.mammals.dog

    In other words, the package structure

    is represented as animals.mammals.dog in the world of Java packages, and a renaming achieves the desired effect.

    Please note that you must not try to achieve this by manually moving the folders in Windows explorer. These actions are best done using your IDE.

提交回复
热议问题