31

So I am creating a program that can automatically open an IntelliJ IDEA Project (.ipr) from the command line. I have it successfully opening with the following command:

Path\To\idea.exe Path\To\ProjectFile\project.ipr

However, if a project is already currently open in IntelliJ IDEA, it will not open a new one in a new window. IT is possible to open a new project in a new window by doing File -> Open... But is there a way to do this via a commandprompt argument (maybe some sort of flag or something?)?

tshepang
  • 12,111
  • 21
  • 91
  • 136
R.J.
  • 663
  • 1
  • 7
  • 14

6 Answers6

20

You can create command-line launcher in IntelliJ IDEA: Tools->Create command line Launcher

This answer can be helpful: https://stackoverflow.com/a/41592203/4191683

Community
  • 1
  • 1
Piotr Korlaga
  • 3,338
  • 2
  • 19
  • 28
16

If anyone else runs into this issue. Just recreate the shell command in Tools -> Create command line Launcher. A fresh launcher worked after update.

Gabe M
  • 2,391
  • 1
  • 15
  • 8
5

Firstly add a path of IntelliJ till bin to an environment variable.

C:\Users\XXXXX.XXXXX\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2019.2\bin

then open command line and enter idea64 <path_to_folder_where_the_project/code_lies>

This will open IntelliJ with a given path.

Himank Batra
  • 301
  • 5
  • 3
2

(Re)creating the idea shell command from the Tools menu works for IntelliJ 2019.x. Just make sure to open a new terminal session once you (re)create the shell command. Then you can open, one or more, projects from the terminal.

idea <my_project>
idea <my_other_project>
AJ Moore
  • 21
  • 4
2

If you see this message enter image description here

for Intellij 2019.+ please check this answer. It uses Jetbrains toolbox. You just need to set path in Generate shell scripts option to /usr/local/bin/ in Jetbrains toolbox https://stackoverflow.com/a/56050914

and then just run idea . or pycharm . etc.

bolec_kolec
  • 500
  • 3
  • 13
0

I'm using older Intellij IDEA 2016. What worked for me is to instruct the launcher to use python2 instead of default python which for me is python3.

So changing #!/usr/bin/env python to #!/usr/bin/env python2 in /usr/local/bin/idea worked for me.

TaylorMonacelli
  • 350
  • 2
  • 3
  • 9