Start two instances of IntelliJ IDE

2019-02-01 15:57发布

问题:

Well my question is pretty simple, how do I start two instances of IntelliJ (community edition). When I have one instance started and I try to start another one, all that happens is that my started instance gets focus.

I'm developing Android applications using IntelliJ.

Any thoughts?

回答1:

You need to configure each instance to use its own folders for config/plugins/system locations by editing idea.properties file on Windows/Linux and Info.plist on Mac. You can find the details in FAQ.

Note that normally it's not necessary since you can open multiple projects in different IDEA frames within the same instance using File | Open Project.



回答2:

Press Ctrl+Alt+S

Choose Appearance & Behavior, then System Settings, check radio button: Open project in new window.



回答3:

File->Settings->General and in section "Startup/Shutdown" check "Confirm window to open project in"



回答4:

CrazyCoder has roughly the right idea. However, setting the config file alone was not sufficient for me to run multiple instances. Here are my steps to get this going (in GNU/Linux, I am sure you can figure out equivalent in other systems):

  1. Create a folder/directory per instance you want to run.

    mkdir -p ~/idea/instance-0
    
  2. Go to the installation directory (e.g. /opt/intellij) and copy the idea.properties (in bin) file over to your instance directory.

    cp /opt/intellij/bin/idea.properties ~/idea/instance-0/
    
  3. Copy 3 more directories: system, plugins, and config. I highly recommend doing this without the running instance

    cp -r /opt/intellij/system ~/idea/instance-0/
    cp -r /opt/intellij/plugins ~/idea/instance-0/
    cp -r /opt/intellij/config ~/idea/instance-0/
    mkdir ~/idea/instance-0/log
    
  4. Open your idea.properties file and update the configurations for your directories:

    #---------------------------------------------------------------------
    # Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
    #---------------------------------------------------------------------
    idea.config.path=${user.home}/config
    #---------------------------------------------------------------------
    # Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
    #---------------------------------------------------------------------
    idea.system.path=${user.home}/system
    #---------------------------------------------------------------------
    # Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
    #---------------------------------------------------------------------
    idea.plugins.path=${user.home}/plugins
    #---------------------------------------------------------------------
    # Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
    #---------------------------------------------------------------------
    idea.log.path=${user.home}/log
    
  5. Now, you can start IntelliJ with the new setup:

    IDEA_PROPERTIES=~/idea/instance-0/idea.properties /opt/intellij/bin/idea
    

Obviously, you probably want to put the command in a script file for invocation. This seems to work for me.



回答5:

As per the directions from jetbrains you'll need go to the 'General' page of the 'Settings' dialog and chose 'Open project in a new window'. Then proceed to open a project as you normally do. IntelliJ should then startup a completely new instance.



回答6:

There is an other very quick way of doing it. There is always an EAP version of the IDE and it can run at same time with the current one. For example I am using AppCode 2017.2 and 2017.3 EAP in parallel.



回答7:

Go go to IntelliJ | Tools | Create Command-line Launcher...

Keep the defaults (which creates a binary named "idea"):

Now, go to your command line.

Cd to your project directory and type: idea .

This will create a .idea directory for IntelliJ configurations for that project, which it will re-use each time to start IntelliJ from that directory.

You can now go to a different project directory and type: idea .

Assuming you left the previous IntellJ IDE open, you will now have two IntellJ IDEs open, one for each project.

Notes:

1) If your project uses environment variables, then I'd recommending opening a separate terminal tab/window for each project and set that project's environment variables before running: idea .

2) Depending on what you're trying to accomplish, you may need to modify your classpath (or settings like Project GOPATH) for each IntelliJ instance.