6

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
-Dosgi.instance.area.default=@user.home/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.

Simbu
  • 766
  • 1
  • 12
  • 37
  • 1
    Possible duplicate of [Eclipse returns error message "Java was started but returned exit code = 1"](http://stackoverflow.com/questions/18609160/eclipse-returns-error-message-java-was-started-but-returned-exit-code-1) – user1231232141214124 Mar 22 '16 at 18:00
  • Installed jdk added -vm line in config file too. updated question with error screen shot and config file content. – Simbu Mar 22 '16 at 19:09
  • Set the JAVA_HOME to `C:\Program Files (x86)\Java\jdk1.8.0_73` without `\bin`. – sulthony h Mar 23 '16 at 01:53
  • Yes i have changed JAVA_Home. Updated in my question. Still i am getting same error. – Simbu Mar 23 '16 at 18:28

7 Answers7

2

Change the path in the .ini-file.

-vm
C:\Program Files\Java\JDK1.8.0_172\bin\javaw.exe 

if you still see the issue Change it into:

-vm
C:\Program Files\Java\jdk1.8.0_172\jre\bin\server\jvm.dll

Note: The path should be in the new line after -vm.

slfan
  • 8,950
  • 115
  • 65
  • 78
  • 1
    Make sure, that the -vm option occurs before the -vmargs command. Everything after -vmargs is passed directly to the JVM. -vm c:/wherever/java/jdk1.6.0_21/jre/bin/server/jvm.dll -vmargs... Credits: https://stackoverflow.com/questions/18609160/eclipse-returns-error-message-java-was-started-but-returned-exit-code-1 – Ganesh M S Jul 28 '20 at 00:00
1

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.

Ahmed Hashim
  • 264
  • 3
  • 10
  • I have dowloade JDK and installed it. In addition to that i have added `-vm C:\Program Files (x86)\Java\jdk1.8.0_73\jre\bin\server\jvm.dll` in my config file too. Still i am getting error. Updated the error screenshot in my question. – Simbu Mar 22 '16 at 19:00
1

I had same issue today with Eclipse Neon.2 after java jre was updated in Chrome Browser from 1.8.0_111 to 1.8.0.131. It looks to me it removed 64 bits version of 1.8.0_111 and installed only 32 bits version of jre 1.8.0.131.

To fix this issue I had to update JDK from 1.8.0_111(64) -> 1.8.0.131(64). This installed as well jre on 64 bits and Eclipse Neon.2 started successfully this time.

aprodan
  • 559
  • 5
  • 17
  • I had a similar problem. We worked alot to get the code run on the Spring Tools Suite (STS) & lost two days. Yesterday at last, it worked at the afternoon, but today in the morning, I got exactly the same error as above in the question. We tried again to copy the installation of the colleague, who uses JDK 1.8.0_111, changed this entry to JDK 1.8.0.131 at my location, and tried, but no avail. At last, we reinstalled JDK 1.8.0_131, restarted the notebook (running Windows 7) – and it worked! – Sae1962 May 17 '17 at 09:58
1

I had exactly similar error. Eclipse worked well after I deleted 'javapath' folder from C:\ProgramData\Oracle\Java directory.

NabRaj_Baitadi
  • 75
  • 1
  • 2
  • 9
0

Earlier i have used 64 bit java. Later i have used (x86) java it caused issue. After updating with 64 bit java the issue got resolved.

Simbu
  • 766
  • 1
  • 12
  • 37
0

In my case the error was pretty silly: in the config.ini there was an error in the last line where the memory parameter -Xmx was set to "2024". I'm pretty sure I did not edit that line by hand. I reverted it to -Xmx1024m to make it work

-Xmx2024m

changed to

-Xmx1024m

the issue seems to be related to the Java vm 1.8.131 (32bit) that responds with an error any time I try to ask more than 1477m, even when I have more than 4GB of free ram:

java -Xmx1477m
Error occurred during initialization of VM
Could not reserve enough space for 1513472KB object heap

on the same PC a JDK 1.7 does not have any issues in using 2GB

user1708042
  • 1,740
  • 17
  • 20
0

I installed java 9 JDK 64 bit. The install took care of everything in my case and allowed me to start the Anypoint studio from my existing short cut. In some cases you may need to still manually edit your settings but try just a 64 bit install first