4

I set in my pom to use java 1.8 like this:

<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>

Then I did a "maven update project" and Eclipse/maven added the 1.8 JRE to the build path instead of the JDK. Hence I got restriction access to java fx classes.

My environment settings should be okay:

>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_05

>java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

>mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-0
2+01:00)
Maven home: C:\Program Files\apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_05\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

Any ideas what should I do to fix it?

I could change the project's build path manually in Eclipse but maven refresh would override it all the time.

zolee
  • 429
  • 4
  • 19

2 Answers2

2

Your command line environment is pretty much irrelevant in Eclipse.

The m2e eclipse plugin will try and select a Java Environment from those present in

Preferences/Java/Installed JREs

If you do not have a JDK listed there then Eclipse will not be able to use it.

Steve C
  • 18,876
  • 5
  • 34
  • 37
  • 1
    JDK was set up there and set as default. Removed the jre, so it can't pick it up. Now it adds the jdk jars to the buildpath but still got the restriction error. If I add the jdk manually to the buildpath then there are no access restrictions defined on the jars. If eclipse adds then it has on the same jars. – zolee Jun 01 '14 at 07:47
  • See also [Using JavaFX in JRE 8](http://stackoverflow.com/questions/22812488/using-javafx-in-jre-8) – Steve C Jun 01 '14 at 07:50
1

Found the right information and solution regarding my issue:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=431067

zolee
  • 429
  • 4
  • 19