Fail to launch application (CreateProcess error=87), can't use shorten classpath workaround

Solution 1:

This eclipsecoding FAQ page does confirm your diagnostic:

When the CLASSPATH gets too long, the program cannot be launched (at least under Windows) - try to shorten your classpath. In the case of a plugin, you can try to remove unnecessary required plugins.

And you have here a thread detailing the log errors.

Since you can launch Eclipse, but not the application, I would check if you don't have too many plugins included in your launch configuration. Could you check if you have added only the required plugins?

Solution 2:

As a workaround:

  1. Open your eclipse run configuration for the task that is failing.
  2. Choose the classpath tab, select the default classpath, click the "Edit.." button
  3. Check the "Only include exported entries" checkbox.

This allowed me to get around this problem on Eclipse 3.6 (Helios)

Solution 3:

This is definitely an issue with the classpath being too long causing the command line to exceed it's maximum limit. to resolve, shorten your classpath. If you are using Maven (like I was - e.g. in Jive development ) then change the location of your .m2 by changing the maven settings.xml

<settings>
  <localRepository>c:/.m2/repository</localRepository>
</settings>

and then move your repository there from the user directory, but ensure that the settings.xml and settings-security.xml (if applicable) are still in the User directory. This way the class path will no longer show c:\Documents and Settings\username.m2 over and over but rather c:.m2 allowing a significant decrease in classpath and thus command length. Remember that in windows you cannot create a directory (by yourself) with name .m2, and so you have to cut the directory, paste in in c: and then copy it back into your user folder

Solution 4:

I was dealing with the same problem on Eclipse, so, for that reason I decided to give a try to the same project on Intellij, just to know if it was a IDE problem.

Surprisingly, Intellij detects this problem (long classpath) and shows me a dialog, recommending me to use dynamic classpath feature. After enable this option, the problem gone.

What dynamic.classpath flag does is: What does the dynamic.classpath flag do? (IntelliJ project settings)

So, now my question is: Is there a way to do the same on Eclipse? seems to be a simple and elegant solution to this problems, instead of removing manually all those dependencies that are not necessary.

Solution 5:

Use a dynamic link which can be easily created with juncion (http://technet.microsoft.com/en-us/sysinternals/bb896768). Create the link for your project and add it to eclipse through that. usage e.g.: md d:\shortname junction d:\shortname\ d:\my\very\long\long\long\long\long\long\projectnamefolder