Monday, September 12, 2011

Eclipse in Windows: Cannot run program (CreateProcess error=87), The parameter is incorrect

You will see this when you exceed the character limits on Windows machine in your Java classpath. The character limit for the Windows is the following:

- Windows XP: 8189 characters
- Windows 7: around 33k characters

You will have to somewhat shorten the classpath. There are potential work arounds to this problem.

1) Use the network drive to shorten the classpath

You can use the network drive to shorten the classpath. Instead of having C:\Program Files\Apache\Maven 3.0\....\\xxx.jar, you can shorten the entire path to (i.g. M:\xxx.jar). Make sure to update your Maven's settings.xml and configure your m2clipse settings accordingly.


2) Use -Djava.ext.dirs JVM parameter and exclude Maven dependencies from your run configuration

It's possible that you might still run into exceeding the class path issue even after setting up the network drive. If this is the case, follow the below steps to resolve the issue.

You can use maven's dependency plugin to export all the transitive dependency jars into the specific location. Look Maven dependency plugin. Configure the Maven dependency plug-in on your pom then execute "mvn dependency:copy-dependencies" to export the jars into the folder (i.e. libs).

Once you have exported all the jars, navigate your Eclipse's runtime configurations. Go to Arguents -> VM arguments and add the -Djava.ext.dirs=libs (if your jar folder is libs). Note that this VM argument is separated by ; so you can enter multiple folders.

6 comments:

web hosting companies in india said...

I like very much your way of presentation. I am so much interested to join your network. Thanks for sharing this post. Keep blogging..best hosting company for small business

Cheap web hosting plans said...

Your web log is incredibly well crafted and shows the tips all around particulars. Your website pretty form replies the problems. With as a result of get discussing.

website hosting company said...

Thanks for sharing this post with us. It's really an amazing post. Keep posting the good work in future too.

Android developer said...

I think most of the peoples are get good programming knowledge from your blog. so i would like to thank for your creation.

Best Web Hosting said...

I think it will help me a lot in the related stuff and is very much useful for me.Very well written I appreciate & must say good job.

Unknown said...

Thanks for the comments. I will keep posting what I find interesting and might be helpful for others.