23

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
  • 11,360
  • 21
  • 88
  • 132
R.J.
  • 563
  • 1
  • 4
  • 14

6 Answers6

15

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
  • 2,979
  • 1
  • 18
  • 27
12

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
  • 1,824
  • 1
  • 13
  • 8
4

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
  • 251
  • 2
  • 3
1

(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
  • 11
  • 3
1

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
  • 440
  • 2
  • 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
  • 336
  • 2
  • 3
  • 8