AndreaNobili AndreaNobili - 2 years ago 214
Java Question

How to change a package name in Eclipse?

In Eclipse I have a simple Java project that contains a package named (default package) and inside this package I have a class

I want to rename this package into something like: com.myCompany.executabe

I tried to select the (default package) ---> right click ---> refactor but now appear to me only the single voice named: Infer generic type arguments but not the possibility to change the package name

Why? What have I to do in Eclipse to change the name of the package?

Tnx

Andrea

Answer Source

First you need to create package:

com.myCompany.executabe (src > right click > new > package).

Follow these steps to move the Java files to your new package.

  1. Select the Java files
  2. Right click
  3. Refactor
  4. Move
  5. Select your preferred package
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download