Cannot run program (java) in (directory "."); file name or extension is too long

111 views Asked by At

I'm encountering an issue in a Java application run job configuration in Eclipse, where I receive a "cannot run program, the path is too long" exception. I suspect it's related to the extensive list of JAR files in my classpath. Despite trying various solutions, including shortening the command line option in IntelliJ, I still face challenges. In IntelliJ, the error changes to "Process Exited with error code 1." I reduce the classpath also, but still I am getting same issue. Any suggestions to resolve this issue would be greatly appreciated.

1.Exception:

java.io.IOException: Cannot run program "D:\sai\Java\jdk11.0.17_B\bin\java" (in directory "."): CreateProcess error-206, The filename or extension is too long
 at java.base/java.lang. ProcessBuilder.start (ProcessBuilder.java:1120)
 at java.base/java.lang.ProcessBuilder.start (ProcessBuilder.java:1071)
 at java.baze/java.lang.Runtime.exec(Runtime.java:592)
 at org.apache.commons.exec.launcher.Javal3Commandlauncher.exec (Javal3CommandLauncher.java:61)
 at org.apache.commons.exec.DefaultExecutor.launch (DefaultExecutor.java:279)
 at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:336)
 at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
 at org.apachy.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:153)
Caused by: Java.io.IOException: CreateProcess error=206, The filename or extension is too long
 at java.base/java.lang.ProcessImpl.create(Native Method)
 at java.base/lava.lang.ProcessImpl.<init>(ProcessImpl.java:492)
 at java.base/java.lang.ProcessImpl.start(Frocess Impl.java:153)
 at java.base/java.lang.ProcessBuilder, start (ProcessBuilder.java:1107)
... 17 more 

2.Run Configuration:

Name : TestDemo 
Project : Demo 
Main Class : com.demo.RunJob 
Program Arguments: -p "testfile.txt" -r 
VM Arguments: -Xmx256M -Xms256M 
-Ddemo.appkey=none 
Runtime JRE: Java 11
0

There are 0 answers