Jhoy Jhoy - 1 month ago 20
Java Question

Migrating from Eclipse to IntelliJ

I am recently moved from eclipse to intellij to program in java. I have the following questions:


  • Eclipse has the concept of a workspace and each project must be in its owen workspace. However, it is a bit different in intellij (from what I understand). When I created a new project in intellij, it created the projects in a default folder called IdeaProjects/



So if I have two folders for my courses (CSCI123 and CYB342) and I want to have my intellij assignments for these courses in a subfolder called Intellij-Stuff ::

eg CSCI123/Intellij-Stuff/Project1
CSCI123/Intellij-Stuff/Project2
CSCI123/Intellij-Stuff/Project


and

CYB342/Intellij-Stuff/Project1
CYB342/Intellij-Stuff/Project2
CYB342/Intellij-Stuff/Project3


Can I have each of my intellij projects in different folders or do they have to be in the IdeaProjects/ folder?


  • How to export my project as a jar with source files (like I do in eclipse)

  • How to import a jar ?

  • How to convert my old eclipse projects to intellij?


Answer Source

When you create the project you are asked for a project location:

enter image description here

You choose that location and it does not have to be in the "IdeaProjects/ folder".

IntelliJ provides a help topic titled Migrating From Eclipse to IntelliJ IDEA which maps Eclipse concepts to IntelliJ concepts. Might be useful to read that to help you apply what you expect (based on how Eclipse behaves/is desigend) to how IntelliJ behaves.

Re your other questions:

  • Export a JAR from IntelliJ
  • Import a JAR: I presume you mean add a JAR as dependency to your project. If so, then if yours is a Maven or Gradle project this will be done for you once you declare the JAR as a dependency. If yours is not a Maven or Gradle project then you can add a dependency manually as follows:
    • Open your project then ...
    • File > Project Structure > Libraries then ...
    • Click on + then ...
    • Choose Java and a file browser will be opened and you can use this to browse to the JAR you want to include in your project.
  • Migrate project from Eclipse to IntelliJ. Again, if your project is a Maven or Gradle project then you can simply open it in Intellij since everything the IDE needs to know about the project structure can be inferred from the pom or gradle file and the conventions of those tools. If your project is not a Maven or Gradle project then you can open an Eclipse project in IntelliJ and IntelliJ will attempt to interpret it. To do this just ...
    • File > New > Project from existing sources ... then
    • Browse to the directory which contains your Eclipse .project or .classpath file