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

19,644

Solution 1

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.

Solution 2

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

Share:
19,644
devsda
Author by

devsda

Updated on June 14, 2022

Comments

  • devsda
    devsda almost 2 years

    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.