50

I'm trying to build a Dynamic Web Application in eclipse using Java 8 (and Wildfly appServer if that matters) but I'm unable to make Eclipse Luna M5 use Java 8 (I do have Java 8 BETA support installed and it works on JavaSE projects).

In my POM I set the level to Java 8:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

But after I do maven -> update project I get the following error:

Could not update project ExampleApp configuration
Version 1.8 of project facet java does not exist.

And indeed there is no java 1.8 project facet under project->preferences->project facets->java

Can I manually create such facet and add It to to eclipse or I'll have to wait until java 8 is released and the eclipse guys decide to add it ?

2
  • Have you taken a look at this? Does it help?
    – LaurentG
    Feb 22, 2014 at 13:54
  • I've installed the early access binaries from there (the beta support) Feb 22, 2014 at 13:58

6 Answers 6

73

There are additional patches available for Kepler SR2 officially. In ecliplse, go to "Help" --> "Market Place" --> Search for java 8 kepler. Then choose and install the following.

  • install Java 8 support eclipse kepler sr2,
  • Java 8 Facets for web tools eclipse kepler sr2
  • Java 8 support for m2e for Eclipse Kepler SR2 (if required)

Reference: http://www.eclipse.org/downloads/java8/

After this, my multi-module maven project with java 8 is building fine without any error in eclipse kepler SR2.

UPDATE: If you are using Spring Tool Suite (STS), then version 3.5.1 has included these features.

2
  • This is the correct answer for STS 3.5.0 RELEASE, which ships with compiler support for Java8, but not the Facets or m2e support.
    – Marty Pitt
    May 3, 2014 at 10:52
  • 1
    @Marty STS 3.5.1 has included these. May 12, 2014 at 5:02
10

There is an official bug report/patch for Kepler SR2. It also works with Spring Tool Suite 3.5.0.RC4 (which is based on Kepler). It should work for Luna too.

Bug report : https://bugs.eclipse.org/bugs/show_bug.cgi?id=430637 (see comment #12)

Update site for the Java 8 facet : http://download.eclipse.org/webtools/patches/drops/R3.5.2/P-3.5.2-20140329045715/repository

2
  • This worked with STS 3.5.0.RC4, but not with STS 3.5.0 RELEASE. Instead, use the approach provided by @Pooma
    – Marty Pitt
    May 3, 2014 at 10:53
  • @MartyPitt actually it's Poorna May 22, 2014 at 15:36
4

While we await official Java 1.8 support, I've made a github fork that contains what I believe are the required changes - these require the Java 8 patches from here first: https://wiki.eclipse.org/JDT_Core/Java8

To install the 1.8 facet support (assuming that you're running 4.3.1 or 4.3.2, and have write access to the main .../eclipse/plugins dir):

  • git clone https://github.com/stevestorey/webtools.common.fproj
  • git checkout java8-support
  • Import the various projects in this feature set into your Eclipse IDE (can be on a new workspace). Specifically you need org.eclipse.wst.common.project.facet.core and org.eclipse.wst.common.project.facet.core
  • Right click on the org.eclipse.jst.common.project.facet.core project and choose "Export" and then "Plug-in development\Deployable plugins and fragments"
  • From the Export dialog, select only the org.eclipse.jst.common.project.facet.core plugin, and choose the bottom "Install into host" radio button, and choose a suitable path (I believe I went with the default, but I don't think it particularly matters)
  • Clicking Finish will build the plugin, and then kick off the installation into your Eclipse environment.

After restarting Eclipse, you should find that 1.8 is now selectable as a Java facet :) (and it also works with M2E enabled projects that specify source/target of 1.8).

Note the instruction from the standard 1.8 patch instructions that the installed JDK /must/ be called "JavaSE-1.8" within the Eclipse properties.

Also note that if/when you update Eclipse (e.g. to upgrade to 4.3.2), you will probably need to re-install the patched version again as the update will put the "official" version of the plugin back in.

1
  • I'm getting "org.eclipse.jst.common.project.facet.core/build.xml:145: java.lang.ClassFormatError: Duplicate field name&signature in class file org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration" while installing the plugin :(
    – user1547039
    Mar 22, 2014 at 19:38
1

I hit exactly the same problem a few days ago. Looks like this will be included into the next release of Eclipse Luna.

Java Version 1.8 of project facet java does not exist

Eclipse Luna M6 is scheduled for release on March 14th so hopefully it will be included then.

1
  • I am using Eclipse Luna 4.4.0 M6 and experiencing the same problem. So LUNA M6 is currently not a fix. Mar 21, 2014 at 19:55
0

Recently Java updated to Java 8 so you need to update to the new Eclipse for it to work. I was running Eclipse 4.3 (Kepler) and I had to upgrade to Eclipse 4.4 (Luna)enter image description here

0

Go to Your Project Property search for project facet and change java version

enter image description here

1
  • 2
    I'm down voting this answer because it is irrelevant. If you have read the question you should have known that the issue is related to LUNA M5 and I've had already tried that. Also if you do not know M5=Milestone 5 and Luna has been released a very long time ago, so your answer is completely inappropriate. Mar 12, 2015 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.