Error when open eclipse - MAC
Asked Answered
G

4

6

I have installed eclipse on my iMac and when I try to open it, it gives me this error:

Failed to find a Main Class in 
"/Applications/Eclipse.app/Contents/MacOS//../Eclipse/ plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar".

On my MacBook Pro, everything works fine, but I have done nothing different.

I have checked other posts, but most of them refer to a windows OS. There was an answer which said that it can just open when everything is in an English folder and this is true for me!

Thanking you in advance!

Graphy answered 10/7, 2018 at 9:5 Comment(0)
C
13

I came across this error after installing Eclipse PDT.

  1. Open your terminal and run the version command: java -version.

  2. If your java version is below 1.8, you will have to update your Java Runtime Environment to at least 1.8.0 by installing an updated JDK here.

  3. Then re-run the java version command and your version should be updated.
  4. You should now be able to install and run Eclipse.
Creatinine answered 10/7, 2018 at 14:24 Comment(5)
my java version is 11, but still i am having this error :/Overcompensation
do you have multiple versions of java on your machine? https://mcmap.net/q/44914/-how-to-set-or-change-the-default-java-jdk-version-on-macosCreatinine
I had only 1 version but i solved the issue. The java version 11 i had, was installed by sdkman. I manually downloaded Java SE 13 from oracle.com, installed it and my Spring Tool Suite 4(built on top of Eclipse) is now working. Thanks for replying Akin.Overcompensation
I downloaded and installed the Oracle Java JRE, but I think it's not getting picked up. For me java is /usr/bin/java. If that is not right, where do I find the one I supposedly installed?Framework
@VictorEijkhout you will need to download the JDK and not just the JRE.Creatinine
E
2

I have the same issue, but on my MacBookPro. I first installed eclipse Photon, which when starting up prompted me to install Java 6, which I did from https://support.apple.com/kb/DL1572?locale=en_US

Then I also installed the latest JRE (jre-8u171-macosx-x64 as of yesterday). When running eclipse again I started getting this error. Then I tried to run from the command line, and got this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/equinox/launcher/Main : Unsupported major.minor version 51.0

When googling that, the answers said that the reason for that is that the Oracle installer does not update the symlink in /usr/bin, which seemed to be confirmed by the fact that running java -version returned this:

java -version
java version "1.6.0_65"

The solutions I found for that were not feasible in MacOS starting in version El Capitan, and I am on High Sierra, so I followed the instructions in this post to fix that, and it worked, now I get:

java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

After all of this, however, I get the same "Failed to find a Main Class" error on the dialog as reported initially here, and the same "UnsupportedClassVersionError" on the CLI that I had when the system was still on java 6, so now I am still stuck and out of ideas.

EDIT: FIXED IT!!

I kept thinking that the problem was the java version, it was somehow still using java 6 (which I had installed due to the initial prompt).

So I followed the instructions here to remove what I had installed for the alleged java 6 issue. Then I found this post in the eclipse forums, which stated at the end (comment added by Eric Rizzo on Tue, 14 February 2017 21:56) that this is not an Eclipse message, but rather an OS message, and that one should NOT do that as apple messed things up with that patch. And then it goes to explain that one should install java 8 JDK (NOT just the JRE as I had done). Once I removed Java 6 and installed the full java 8 JDK, it ran fine :)

Explain answered 10/7, 2018 at 15:7 Comment(0)
P
1

You can edit the eclipse.ini with your vm configuration in the beginning of the file

-vm
/yourJvmPath/jdk-12.0.1.jdk/bin/java

cat /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

-vm
/Users/SomeUser/jdk-12.0.1.jdk/bin/java
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.400.v20190515-0925.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.1000.v20190125-2016

PD. It works with ApacheDirectoryStudio for MAC

Pratfall answered 12/9, 2019 at 19:14 Comment(0)
A
0

This one works for me with MAC OS Mojave. You can download the Java SE Development Kit 8u221 for mac from the below link.

jdk-8u221-macosx-x64.dmg

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Armor answered 2/8, 2019 at 11:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.