Sunday, December 14, 2014

Eclipse: Java was started but returned exit code=13

Recently I have an update from Oracle on my Windows 7's Java jre. After i suddenly was no longer able to launch my Eclipse or Spring Tool Suit application. It always throw the following error when i try to launch the Eclipse application.

Java was started but returned exit code=13
-os win32
-ws win32
-arch x86_64
-launcher D:\STS\sts-3.6.3.RELEASE\STS.exe
-name STS

I was in a bit of shock initially, but realized that somehow, the update may have messed up my default java jre path, as the error indicating it is using javaw.exe from "C:\ProgramData\Oracle\Java\javapath;" and i don't remember that i set include java's bin path as this directory. Therefore, I run the following commands:

> java -version
> javac -version

True enough they refers to very different version, next I want to find out which version of java.exe i am currently using and from which directory, and i run the following command:

> for %i in (java.exe) do @echo.   %~$PATH:i

The print out indicates the current java.exe being used is from "C:\ProgramData\Oracle\Java\javapath;", I then remove the "C:\ProgramData\Oracle\Java\javapath;" from the $PATH system environment variable.

Further mess up was noticed when i rerun the command "for %i in (java.exe) do @echo.   %~PATH:i" and some other app's java.exe shows up. This is finally fixed when I move my JAVA_HOME/bin directory to be the first entry in the PATH system environment variable. This finally fix my problem.

No comments:

Post a Comment