Last Updated: October 22, 2018
·
44.71K
· ihcsim

Eclipse/JUnit CreateProcess error=206. Filename or extension is too long.

Bump into this today while trying to run some junit tests from within eclipse (helios) on Windows 7.

Error:

java.io.IOException: Cannot run program "C:\Program Files\Java\jre6\bin\javaw.exe" (in directory ""): CreateProcess error=206, The filename or extension is too long
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:818)
at org.eclipse.jdt.launching.AbstractVMRunner.exec(AbstractVMRunner.java:73)
at org.eclipse.jdt.internal.launching.StandardVMRunner.run(StandardVMRunner.java:317)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:174)
....

Two solutions

  • Eclipse patches:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

  • Shorten classpath:

http://stackoverflow.com/questions/201816/how-to-set-a-long-java-classpath-in-msdos-windows

To apply the Eclipse patches:

  • Download bug3271933.4.2hack.zip from the above link
  • Back up existing eclipse/plugins/org.eclipse.jdt.launching_3.4.*.jar
  • Copy and paste classes in the patch to org/eclipse/jdt/internal/launching in your org.eclipse.jdt.launching JAR (replace existing files)
  • Edit the META-INF /MANIFEST.MF file in your org.eclipse.jdt.launching JAR file by removing everything starting from the first "NAME:" entry. Make sure you leave two (2) line break characters at the end of the file.
  • Re-start eclipse

Hope this helps if you can't find an easier solution.

28 Responses
Add your response

Hi,

I tried to use the patch by following the above steps and the issue still exists. My eclipse version is Juno and OS is Windows 7. Could you please let me know if I have to use another patch? I also tried to map C:\ccviews\jpannikkview15\ccrs_new" to another drive to reduce the class path length. Still no luck.

If yo could let me know if there is another way to resolve this issue, I really appreciate it.

Thanks,
Jaya

over 1 year ago ·

@jpannikk c:\ccviews\jpannikkview15\ccrs_new doesn't look like a long path to me. Does your classpath includes long paths? Can you try a quick experiment by copying your test codes to a shorter path to see if that works?
Assuming you copied all the classes in the patch to the right location under the Eclipse home folder, it should work after a restart.
Let me know how it goes.

over 1 year ago ·

@jpannikk Also, which patch did you use? I used the bug3271933.4.2hack.zip (dated 2012-08-15) patch.

over 1 year ago ·

Hi,
I used the same patch.

Thanks,
Jaya

over 1 year ago ·

@jpannikk Can you write your tests outside of eclipse, say using maven?

over 1 year ago ·

Hi , This post really helps to solve my problem which i was facing for very long time.Great work...
Thanks much

over 1 year ago ·

@dpkkaruna can i get an upvote then? :-)

over 1 year ago ·

Done :)

over 1 year ago ·

This helped us a lot. Amazing how a relatively simple trick saves plenty of developer's time. Thanks!

over 1 year ago ·

@javicka Glad it helps. Can I get an upvote on the protip please?

over 1 year ago ·

you saved the day thank you , i just followed the instructions you had said , works well . but what problem did you exactly address i am just curious.

over 1 year ago ·

This was really very helpful.

Keep doing the best work.

over 1 year ago ·

Thanks a lot! Applying the Eclipse patches works!

over 1 year ago ·

Try " Long Path Tool " is also useful in situations where you see these error messages:
Cannot read from source file or disk, there has been a sharing violation,
cannot delete file or folder, the file name you specified is not valid or too long,
the source or destination file may be in use and many other file managing errors that you encounter in your computing use.

over 1 year ago ·

Try to long path tool. It is very helpful.

over 1 year ago ·

Use "Long path tool" to solve the error like deleting, renaming, copying etc.......

over 1 year ago ·

“Long Path Tool” is very helpful for this error !
You can use to solve this problem

over 1 year ago ·

Long path error!
"Long path tool" is very helpful for this problem. You can solve this problem like copy, delete, long path files by using this tool.
I used to have similar problems too, but after using "long path tool" everything was solved.

over 1 year ago ·

Use Long Path Tool, Long Path Tool can simplify and probably end your problems in unlocking, managing and renaming files that appear to have a long filename.

over 1 year ago ·

Long path tool is the very good program for error, unlock solution.
Try it and solve your problem.
I used long path tool and I solve my error, unlock problem solution.

over 1 year ago ·

errrhhhh

over 1 year ago ·

Long Path tool is a great tool for fixing problem.

over 1 year ago ·

Hello,

I had the same problem. I didn´t know what to do so I searched on the internet for some solutions.

And I read about [b]Long Path Tool[/b], which is a great tool in these type of cases. :o

It worked really well. Hope it works for you too :p

over 1 year ago ·

Hi I encounter the same problem but only Long path tool helped on this. try using it too. I hope It helps .

over 1 year ago ·

I tried using the long path tool program. I already use it several time now and It works perfectly for me.

over 1 year ago ·

Hi, can anyone teach me how to use Long Path Tool with eclipse? eclipse plugin? I can't query this plugin, I just can search eclipse plugin 'Path tool', but it's no use for me

over 1 year ago ·

@Hillery Are you online?

over 1 year ago ·

I've been suffering this for about a week, and I wasn't keen on these suggestions.
In the end I did this:
1. Go to Debug As->Debug Configurations
1. Go to JRE page, select Alternative JRE
1. Click on Installed JREs
1. Edit the JRE, and change the path from "C:\Program Files\Java..." to "C:\Progra~1\java..."

over 1 year ago ·