I have the latest version of intellij 2018.1.1 and I am running a very basic maven project. I get an error message as "Command line is too long" when I try to run main. I updated the run config to JAR Manifest and now intellij doesnt pick up the latest changes in my java files. I am assuming it picks up a pre-made jar and doesnt re-compile? I am trying to figure out how to get intellij to work.
-
There are [multiple options](https://blog.jetbrains.com/idea/2017/10/intellij-idea-2017-3-eap-configurable-command-line-shortener-and-more/) to shorten the command line, try some other one. In case the issue persists, share the [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – CrazyCoder Apr 12 '18 at 11:29
-
Will do, thank you. Why does intellij not pick up the changes in the code though? – zooes Apr 12 '18 at 11:31
-
Hard to say without the MCVE. Check [idea.log/build.log](https://intellij-support.jetbrains.com/hc/articles/207241085) for errors. – CrazyCoder Apr 12 '18 at 11:33
-
Thanks, I looked through the logs, and I dont see any glaring errors. A sample light weight applications seems to be starting up just fine. It looks like the problem is when I have dependencies. I couldnt share my current project with you since its internal. Are there any other options I could try? – zooes Apr 12 '18 at 11:50
-
1I have no command like args, so why does intellij think that its too long? – zooes Apr 12 '18 at 11:51
-
Try reproducing with a dummy project having similar structure. Try to delete `.idea` directory and reimport from Maven. – CrazyCoder Apr 12 '18 at 11:51
-
It's too long because the path of the command contains all the dependencies. – CrazyCoder Apr 12 '18 at 11:51
-
1How do I check what command intellij is trying to use? – zooes Apr 12 '18 at 11:52
-
1I have this issue only after upgrading. – zooes Apr 12 '18 at 12:02
-
Does this answer your question? [How to configure "Shorten command line" method for whole project in IntelliJ](https://stackoverflow.com/questions/47926382/how-to-configure-shorten-command-line-method-for-whole-project-in-intellij) – Maulzey Feb 04 '20 at 18:22
8 Answers
To fix this, Edit the configuration the Run/Debug job in Intellij and select an appropriate "Shorten Command line" value that makes sense for your environment. Then try running the test again. If you are not sure about the correct value, simply try each of them till you get it to work. Here's a screenshot and the value that worked for me on Windows.

- 10,546
- 18
- 67
- 109
In the newer versions of Intellij they've hidden the menu for shortening the command line by clicking "More Options" then select the Short Command Line.

- 37,646
- 24
- 106
- 138
change project/.idea/workspace.xml
from
<component name="PropertiesComponent">
...
</component>
to
<component name="PropertiesComponent">
<property name="dynamic.classpath" value="true" />
...
</component>

- 61
- 2
Inside your .idea folder, change workspace.xml file
Add
<property name="dynamic.classpath" value="true" />
to
<component name="PropertiesComponent">
.
.
.
</component>
Example
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="dynamic.classpath" value="true" />
</component>

- 4,100
- 5
- 22
- 30
Try to delete .idea folder and import the project again. Run 'mvn clean compile' and then run the main method.

- 96
- 6
I needed to add before launch settings to make it work with JAR Manifest option to shorten command line. This did the trick for me. Thanks for the quick responses!

- 1,280
- 3
- 15
- 21
-
-
1Run all your TC's and it should create an intellij config setting for you. Now, edit this newly created config. – zooes Oct 24 '18 at 19:39
-
-
In Intellij go to Run > Edit Configuration > Shorten Command Line. I picked "Jar Manifest" to make it work. – zooes Oct 15 '19 at 16:24
I had the same issue and resolved it in :
- closing IntelliJ
- removing the
.idea
directory - Reopening the project

- 450
- 1
- 7
- 11
Each and every test method was failing with the "Command line is too long..." and the solution that worked for me was adding the below:
<component name="PropertiesComponent">
....
<property name="dynamic.classpath" value="true" />
</component>

- 57,590
- 26
- 140
- 166

- 31
- 1