Jason Kim's Blog

Updating Eclipse Kepler and Fixing its Woes on Mac OS X Yosemite
2014-11-11

tl;dr

  • Installing Java 8 on Mac OS X Yosemite
  • Updating Eclipse Kepler to work with Java 8
  • Fixing Error: Could not find or load main class packageName.ClassName
  • Fixing No JREs in workspace compatible with specified execution environment: JavaSE-1.8

Dirty Java 8 and Eclipse

Making Eclipse Kepler to work with Java 8 on Mac OS X Yosemite wasn't all that obvious. I guess this is why people hate Eclipse so much. Here are the steps I followed to make Eclipse Kepler to work with Java 8.

  1. Visit this page.
  2. Follow the section, Installing Java™ 8 support for Eclipse Kepler SR2.
  3. Install Java SE Development Kit 8.
  4. Follow the subsection, Use the Eclipse Marketplace to add Java™ 8 support to your Eclipse Kepler SR-2 package.
  5. If you attempt to create a new project, a new package then a new class with a main function and run it, you might get an error that goes: Error: Could not find or load main class packageName.ClassName
  6. One of the top hits on Google for this error was this Stackoverflow page.
  7. When I right-clicked on the project and tried to edit the build path, I kept on seeing No JREs in workspace compatible with specified execution environment: JavaSE-1.8.
  8. To fix this, I found another Stackoverflow page that suggested a solution.
  9. The problem is how the fuck do you know where Java 8 is? Thankfully, there a command in terminal you can run /usr/libexec/java_home -V.
  10. Look for "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
  11. Go through the second Stackoverflow page with the newly found location of Java SE 8.
  12. You should be able to run the example program now.