7

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.

RuuddR
  • 941
  • 4
  • 13
  • 25
  • I've been using IntelliJ for half a year now, and I've never seen an option to do this; never looked either though. Aren't a client and server arguably part of the same project? I always just divide my project's package into client and server directories. – Carcigenicate Mar 09 '17 at 21:09
  • 2
    If you always need them both open, why not add both modules to the same one project? You can do that even if they're in separate directories/repos/whatever. Just import module. – yshavit Mar 09 '17 at 21:09
  • That's something I could do. Just divide them into 2 modules under the same project. Then comes my second question: is it possible to push and pull these modules seperately to github? – RuuddR Mar 09 '17 at 21:11
  • If your project (module) has submodules (e.g. as in maven), than you can open just the submodule (e.g. server or client) by calling File -> New Project from Existing Sources. Than you can open both with different windows. (But later on you need to do two clicks) – Michael von Wenckstern Mar 09 '17 at 21:15
  • Yeah, that's what have been bothering me. I just want to be able to quickly load up the server and client at the same time. I think I'll just make 2 modules, one for the server and one for the client. Is it possible to push and pull these modules seperately to github? – RuuddR Mar 09 '17 at 21:17
  • file -> open and then in the dialog, choose new window. That will leave the already open project window alone and open a new window for the next project – David Zimmerman Mar 09 '17 at 21:35
  • @DavidZimmerman This is what I've been doing constanlty, but I think there is a better way. – RuuddR Mar 09 '17 at 21:37
  • The better way is using a shortcut. Or closing IntelliJ by File | Exit, so it reopens both projects on start. – Meo Mar 09 '17 at 21:38
  • You don't suggest using modules? – RuuddR Mar 09 '17 at 21:39
  • Sure, use modules, what's the problem with that? – Meo Mar 09 '17 at 21:40
  • I'm not sure if I can push and pull the modules seperately, is that possible? – RuuddR Mar 09 '17 at 21:40
  • Why don't you just try it? – Meo Mar 09 '17 at 21:42
  • I can't import a repository into a module, so I don't think this is possible. – RuuddR Mar 09 '17 at 22:07
  • You can set separate VCS roots per modules, so it's not a problem, one module can even be in Git, another in Subversion. – CrazyCoder Mar 10 '17 at 21:37
  • Okay, and do you know how to do that? – RuuddR Mar 10 '17 at 21:40

4 Answers4

10

This is from the Webstorm docs, but it also works for IntelliJ Idea. I have set the option to "Confirm window" so that Idea asks me every time I want to switch to another project whether I want it in a new window:

Changing the project opening policy

In the Settings/Preferences dialog ⌃⌥S, go to Appearance and Behavior | System Settings.

In the Project opening area, select the project opening policy.

  • Confirm window to open project in: This option is selected by default. WebStorm displays a dialog where you can choose to open the project in a new window, reuse the existing window, or add the new project to the currently opened one.

  • Open project in new window: Select this option to silently open each new project in a new window.

  • Open project in the same window: Select this option to silently close the project opened in the current window and open a new project in it.

enter image description here (Screenshot: GoLand 2022.3.2)

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Matthias Bohlen
  • 598
  • 6
  • 12
1

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

vaughan
  • 6,982
  • 6
  • 47
  • 63
  • Maybe it can be improved by using some `open` flags specified here: http://brettterpstra.com/2014/08/06/shell-tricks-the-os-x-open-command/ – vaughan Nov 05 '17 at 10:55
0

Use can use this script do open all projects in background tasks

#!/bin/bash

# Run a command in the background.
_evalBg() {
    eval "$@" &>/dev/null & disown;
}

# in some cases is necessary open the application before projects 
webstorm && sleep 1;

_evalBg "webstorm /home/user/development/projects/first";
_evalBg "webstorm /home/user/development/projects/second";

This script is assembly with informations provided by executing shell command in background from script questions. All merits to the original author.

kran1um
  • 972
  • 2
  • 20
  • 33
0

After long due now, IntelliJ Idea now supports multiple windows from IntelliJ IDEA 2022.2.2 (Ultimate Edition), earlier we used to add project as module, but that’s not the right way. Follow these steps your life would be so easy.

Steps to follow to open multiple windows in IntelliJ IDEA

  1. Download latest version of IntelliJ IDEA from here.
  2. Once download, restore default setting using below steps: File > Manage IDE settings > Restore default settings

enter image description here

  1. Now when you open a new project you will see this window:

enter image description here Reference: CodeDaily

DeepanshuJ
  • 161
  • 2
  • 6