Tuesday 18 October 2016

Eclipse - Java was started but returned exit code=13

Eclipse - Java was started but returned exit code=13



Steps  -
1. Set the JAVA_HOME Variable

  1. Right-click the My Computer icon on your desktop and select Properties.
  2. Click the Advanced tab, then click the Environment Variables button.
  3. Under User Variables, click New.
  4. Enter the variable name as JAVA_HOME.
  5. Enter the variable value as the installation path for the Java Development Kit.
  6. Click OK.
  7. Click Apply Changes.
 2. Update the Path variable


  1. Right-click the My Computer icon on your desktop and select Properties.
  2. Click the Advanced tab, then click the Environment Variables button.
  3. Under System Variables, click New..
  4. Create the variable value as the installation path for the Java Development Kit.
  5. Click OK.
  6. Click Apply Changes.
Even after Updating JAVA_HOME and Path variable, issue continued with below exception 

Instead of referring to updated installation path, eclipse was referring to above highlighted path.

3. Open Command Prompt - execute below commands
    3.1  java -version
    3.2  javac -version
java and javac are referring to different versions of jdk 

Under System Variables, Delete C:\ProgramData\Oracle\Java\javapath . unfortunately this didn't worked and java and javac still continued referring to different versions of jdk 
4. After investigating an bit,In  C:\ProgramData\Oracle\Java\javapath - .symlink files are default created during installation (ProgramData) is an hidden folder -

take an backup and flow below steps
  • Delete all symlinks under this folder(symlinks are not shortcuts)
  • Open a command prompt in the same directory and create new Symlinks using the "mklink" command.
for more information on mklink refer this url- https://technet.microsoft.com/en-us/library/cc753194(v=ws.11).aspx

How to create symlink - Navigate to installation path\bin folder in command prompt and execute below commands - 
1. mklink java java.exe
2. mklink javaw javaw.exe
3. mklink javaws javaws.exe 


After you execute above commands you could view symlinks created - 
Add caption
Copy paste the java.symlink , javaws.symlink and javaw.symlink to  C:\ProgramData\Oracle\Java\javapath folder - and  execute java -version and javac -version command to verify jdk versions.

This should work fine - But if it still refers to different version of JDK then -  Just copy paste 
1. java.exe
2. javaw.exe
3. javaws.exe 
file from installtion path/bin folder to C:\ProgramData\Oracle\Java\javapath folder execute java -version and javac -version command to verify jdk versions.


This should work fine .

- Happy Learning

   

   

No comments:

Post a Comment