Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot run program, error=7, Argument list too long

I faced error while running unit test in intellij. Below is error message.

Error

Error running CLASS_NAME.TEST_METHOD_NAME: Cannot run program "JAVA_PATH/bin/java" (in directory "WORKSPACE_PATH"): error=7, Argument list too long

Below is the resolution, I found on SO -

Set dynamic.classpath (property present in workspace.xml) to true.

Negative-effects -

But because of above resolution, other unit tests are failing now.

Reason - it is not loading other dependent module classpaths.

These are the links related to this problem - link1, link2

If anyone have any solution/workaround for this, please help me.

like image 501
devsda Avatar asked Aug 07 '15 11:08

devsda


2 Answers

https://blog.jetbrains.com/idea/2017/10/intellij-idea-2017-3-eap-configurable-command-line-shortener-and-more/

looks like in modern variants of intellij you can select to put your path into a file or similar, this prevents expansion of your path to insane length.

Thus changing the "shorten command line" parameter to JAR Manifest should fix the issue.

like image 154
Alexander Oh Avatar answered Oct 19 '22 22:10

Alexander Oh


Go to Run -> Edit Configuration... -> Change Shorten Command Line to JAR manifest.

like image 6
sorry_I_wont Avatar answered Oct 19 '22 22:10

sorry_I_wont