Felix Putzenlechner
Felix Putzenlechner

Reputation: 119

Error when open eclipse - MAC

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!

Upvotes: 6

Views: 24679

Answers (4)

emedinag
emedinag

Reputation: 21

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

Upvotes: 1

Hardeep Singh
Hardeep Singh

Reputation: 1

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

Upvotes: 0

Tuco
Tuco

Reputation: 21

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 :)

Upvotes: 2

Akin Williams
Akin Williams

Reputation: 658

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.

Upvotes: 13

Related Questions