2

My project path: c:\dev_latest

Java-version: JDK7 update 21 (I cannot use any other version due to project limitation)

Build Tools: Ant, Gradle

IDE: IntelliJ 17.3,

OS: Windows 10.

tried but not worked for me links:

1) CreateProcess error=206, The filename or extension is too long when running main() method

2) Createprocess error=206; the filename or extension is too long

3) https://coderwall.com/p/795oma/eclipse-junit-createprocess-error-206-filename-or-extension-is-too-long

4) How to set a long Java classpath in Windows?

I am sick of getting this exception :

Caused by: java.io.IOException: Cannot run program "C:\Java\jdk1.7.0_21\jre\bin\java.exe": CreateProcess error=206, The filename or extension is too long
    at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1257)

A week before my code was running just fine. Now I am stuck.

None of the previous answers on the forum resolved my issue.

My colleagues are on same environment but they are not experiencing the same issue.

Thanks in advance.

  • Maybe you should add some links those not working answers. This way nobody gives you the same answer again. Also, format your code the next time for better readablity. – common sense Dec 06 '17 at 18:11
  • Possible duplicate of [CreateProcess error=206, The filename or extension is too long when running main() method](https://stackoverflow.com/questions/10519558/createprocess-error-206-the-filename-or-extension-is-too-long-when-running-main) – common sense Dec 06 '17 at 18:13
  • @Konafets I am not using Eclipse still I followed the steps mentioned there. However my problem is not resolved. – Jeevesh Mishra Dec 06 '17 at 18:23
  • This is just an example of insufficient problem describing. Please reference or explain everything you did before, like linking to questions here or show some more code. Otherwise its hard to help you. – common sense Dec 06 '17 at 18:26
  • @Konafets hope it looks better now – Jeevesh Mishra Dec 06 '17 at 18:28
  • any solutions for this? – ono Jul 25 '18 at 21:27

2 Answers2

0

Just change the launch configuration to avoid using the default shorten line.

see this image for more info.

This will worked for me.

Trushit Shekhda
  • 563
  • 7
  • 18
0

This is very similar to CreateProcess error=206 The filename or extension is too long, and the issue is related (even though it is a different version of IntelliJ, and what you are doing is different).

The problem exists in the IntelliJ workspace, and so you must manually add dynamic.classpath in order for it to work as you expect -- this is in addition to "shorten classpath" setting in the run configuration.

I would not say this is a duplicate question, but it's 90% the same (as it's the same underlying fault causing the issue).

Nathan
  • 937
  • 9
  • 15