IntelliJ IDEA How-To

Migrating applications from Eclipse 3.x to IntelliJ IDEA

Screenshots shown below may slightly differ from actual product appearance.


Since IntelliJ IDEA and Eclipse JDT are both Java IDEs, the migration of Java applications is quite simple, with respect to several terminology differences, however. For example, what in Eclipse is called "project" is IntelliJ IDEA "module". IntelliJ IDEA's "project", in the turn, is somehow similar to what Eclipse users know as "workspace". Actually, to migrate Java applications that are not Eclipse plugins to IntelliJ IDEA, all you need is to create the similar project structure in IntelliJ IDEA as you have in Eclipse. If you want to migrate the Eclipse Rich Client Platform (RCP) application , refer to the Using IntelliJ IDEA for Eclipse RCP development article.

So, lets begin with the migration with step-by-step instructions.

  1. Create a new project in IntelliJ IDEA (File | New project ).
    Screenshot

    Pop up larger screenshot

    The project file location is the path to the IntelliJ IDEA project file. When you migrate an application, it can be reasonable (although not obligatory) to specify here the location of the application folder, so that IntelliJ IDEA will create its project file in the same folder.
  2. In the next wizard step, specify the path where the compiler will store its output files. IntelliJ IDEA suggests the path based on the project file location (specified in the previous step). If you have a separate output folder for your Eclipse projects, you can specify this folder here.
    Note that the default output path used in Eclipse differs from one suggested by IDEA, so change 'classes' to 'bin' if you create your IDEA project in the same location where you have the Eclipse project with default output folder already.
    Screenshot

    Pop up larger screenshot

  3. Specify a project JDK that will be used to compile, debug and run your program from IntelliJ IDEA. It is also used for standard Java SDK class resolution, opening library sources and Javadoc documentation (the typical set of IntelliJ IDEA code assisting tools).
    This configuration is stored in IntelliJ IDEA project file and can be shared between team members if you put the project file into your VCS.
    Screenshot

    Pop up larger screenshot

  4. If you have only one project in the Eclipse workspace or all your workspace projects you want to migrate don't depend on each other, you can create a single-module IntelliJ IDEA project. Otherwise, you need a multi-module configuration, where you need to create as many IntelliJ IDEA Java modules as you have projects in the Eclipse workspace.
    Screenshot

    Pop up larger screenshot

  5. In the Project Structure window, click the "+" icon to add a module.
    Project Structure
  6. Select Java Module and click Next.
    Screenshot

    Pop up larger screenshot

  7. For each module you need to configure its content root and source directory.
    The content root includes all necessary files and folders for your module (resources, source files and other module artifacts). If you create the IDEA project in the existing folder where the Eclipse project is located, use this folder as module content root.
    Screenshot

    Pop up larger screenshot

  8. Specify the module source directory. That is the folder where top-level packages must be located (the path should be relative to the module content root).
    Screenshot

    Pop up larger screenshot

    The existing source roots of your Eclipse project located in the module path will be recognized automatically, except the external linked folders. These external roots should be added manually: new folder should be created under the module content root and the sources should be copied there, and then this folder should be marked as module source root.
  9. To add another module to the IntelliJ IDEA project, repeat steps 6 - 8.
  10. If the migrated Eclipse projects you have transformed to IDEA modules reference each other , you need to add the referenced modules to the module dependencies of the module that depends on them.
  11. If your Eclipse projects use some external libraries you need to create the project library consisting of these classes and add it to the classpath of the modules that use them.
  12. Special note: if your Eclipse project is developed using Standard Widget Toolkit (SWT ) and you used to run it as SWT Application, it is not enough to add the corresponding Eclipse plug-in jars to the library path - you should extract the SWT JNI libraries and include them to the working directory of the process you run to make the native widgets available (or provide the -Djava.library.path={extracted-libraries-path} option while running your IDEA application).

That's all! Now you can edit, run and debug your Eclipse application from IntelliJ IDEA.