By: Derek Berube, Wildstar Technologies, LLC. Last Update: August 21, 2014Back on Tuesday, the 18th of March 2014, Oracle announced the general availability of version 8.0 of the Java Development Kit. A few days later, I purchased the Manning Early Access Program (MEAP) edition of "Java 8 In Action", so I opened an instance of Safari, downloaded, and installed Java 8 on my Macbook Pro. A few months later, the Eclipse foundation announced the availability of the Luna release train for the Eclipse platform. As a technology enthusiast, I felt compelled to migrate my development environment the newest edition of Eclipse. One of my favorite hosted web application runtime environments is the Google App Engine platform. App Engine provides a Java 7 JVM in a sandboxed environment and attempting to visit a site that has been compiled using the Java 8 compiler would result in a browser window displaying the following information. If you examine the log file for your Google App Engine application, you will see a java.lang.UnsupportedClassVersionError error message similar to the one shown below: Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@127a3f{/,/base/data/home/apps/s~wildstarservicedesk-hrd/8.378133879001426123} org.mortbay.util.MultiException[java.lang.UnsupportedClassVersionError: org/apache/jsp/crm/index_jsp : Unsupported major.minor version 52.0, java.lang.UnsupportedClassVersionError: org/apache/jsp/index_jsp : Unsupported major.minor version 52.0, java.lang.UnsupportedClassVersionError: org/apache/jsp/login_jsp : Unsupported major.minor version 52.0] NOTE: If you are like me and would like to see Google update the App Engine platform to be compatible with the Java 8 platform, please "star" issue 9537 in the App Engine public issue tracker. SolutionThe Eclipse platform provides a configuration file, the eclipse.ini , which is used to configure configure the bootstrap environment and underlying Java Virtual Machine. Instructing the Eclipse launcher to use the Java 7 JRE versus the default Java 8 JRE requires the use of the -vm parameter which is followed by the path to the java executable. On my machine, the eclipse.ini file is located in the /Applications/Eclipse/Eclipse.app/Contents/MacOS folder. The following are the contents of that environment BEFORE I made any changes. -startup ../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20140603-1326 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -vm /Library/Java/JavaVirtualMachines/jdk1.7.0.jdk/Contents/Home/bin/java The following is a complete copy of my eclipse.ini file AFTER making the change. I've highlighted the new line in a boldface blue font. -startup ../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20140603-1326 -vm /Library/Java/JavaVirtualMachines/jdk1.7.0.jdk/Contents/Home/bin/java -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts After restarting Eclipse, you can confirm the above parameter has worked by displaying the "About Eclipse" page for the application and then left-clicking on the "Installation Details" button. Navigate to the "Configuration" panel and then locate the -vm parameter as depicted in the screen shot below. ReferencesInformation from the following sources were used in the composition of this article.
|