Search code examples
javaeclipseintellij-ideaautomation

Intellij, open two projects at once


This is not one of the many questions about having two projects in the same window, like eclipse. What I want to ask is, is it possible to open 2 projects when you click one. Here is an image to describe what I want to do: IntelliJ interface with markings on it

So when I press one of the projects in the red rectangle that it opens both in the rectangle, because I always need a server and a client running at the same time, so I was thinking, maybe there is a way to automate this process and just click one of the two and it opens two.


Solution

  • Use CLI. Add /path/to/intellij.app/Contents/MacOS/idea to your PATH.

    idea ~/dev/a; sleep 1; idea ~/dev/b
    

    Didn't work for me if I didn't sleep.


    With JetBrains Toolbox the executable is in a strange place so I use this config in my ~/.bashrc. You have to update the version number when installing new versions in the toolbox.

    export LATEST_IDEA_VERSION_NUMBER="ch-0/173.3531.6/IntelliJ\ IDEA\ 2017.3\ EAP.app"
    export JETBRAINS_TOOLBOX_ROOT="${HOME}/Library/Application\ Support/JetBrains/Toolbox/apps"
    export LATEST_IDEA_VERSION_CLI="${JETBRAINS_TOOLBOX_ROOT}/IDEA-U/${LATEST_IDEA_VERSION_NUMBER}/Contents/MacOS/idea"
    alias idea="open -a ${LATEST_IDEA_VERSION_CLI}"
    

    For other platforms see: https://www.jetbrains.com/help/idea/opening-files-from-command-line.html