Java was started but returned with exit code=1

Simbu picture Simbu · Mar 22, 2016 · Viewed 39.7k times · Source

I am receiving error called - Java was started but returned with exit code=1

Updated Error image after installing JDK

I have received this error after upgrading my java. I can see my ini file has below content.

 -startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-vm C:\Program Files (x86)\Java\jdk1.8.0_73\jre\bin\server\jvm.dll
-vmargs
-Dfile.encoding=UTF-8
-Xms512m
-Xmx1536m
-XX:MaxPermSize=512m
[email protected]/AnypointStudio/workspace

JAVA_HOME has value as C:\Program Files (x86)\Java\jdk1.8.0_73 Path env has value as C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Java\jre1.8.0_73\bin;C:\Program Files (x86)\Java\jdk1.8.0_73\bin;

My new updated jre is in below location. C:\Program Files (x86)\Java\jre1.8.0_73\bin

Note that i found many solutions for this issue in this site which are not working for me. Kindly guide me where i am doing wrong.

Answer

Ahmed Hashim picture Ahmed Hashim · Mar 22, 2016

You need only JRE to be able to run Eclipse but of course to be able to compile Java code you need JDK.

It is recommended to use JDK for Java_Home, in case you will continue using the JRE you must set set the JAVA_HOME to "C:\Program Files (x86)\Java\jre1.8.0_73".

One of the tricks to copy JRE1.8.0_73 directory to eclipse directory and rename it to jre. This will be used by eclipse default even if there is multiple JRE installed on your environment.

Last point, make sure that you restore memory setting in config.ini (xms, xmx, MaxPermSize) to default values. MaxPermSize will be ignored by Java8 JVM but you can keep it.