I see a number of similar questions
But none with the same circumstances as mine. I've tried their solutions anyway (when relevant) and they haven't helped.
I had created a JavaFX FXML Application in NetBeans 8.0.2 and had to manually upgrade the JDK from 1.7 to 1.8 to get features I wanted. I believe I was using 1.8.0_52 for both the JRE and the JDK and the project was compiling fine. Then my computer notified me of an update for Java 8. Now:
mc@MC-Desktop:~$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
mc@MC-Desktop:~$ javac -version
javac 1.8.0_60
and suddenly any Java 8 FXML project gets the above error message during compile-time, even the standard basic JavaFX FXML Application
that comes with NetBeans. Java 7 FXML will compile but 7 is missing important features. I've started new projects specifying 8 and I've started a new project in 7 and then upgraded it to 8: same result.
I've ensured that the Source/Binary Format is JDK 8, in the Sources category and the Java Platform is set to JDK 1.8 in the Libraries category of the project's properties. I can find no other setting to update. I've tried a clean build each time I change a setting. The error happens in an IDE-generated file jfx-impl.xml
that is too large to post in its entirety, being over 4000 lines. I post a portion here. The classpath="${javafx.ant.classpath}"
is line 406, where the compiler reports the error:
<target name="-check-ant-javafx-version" depends="-pre-check-ant-javafx-version,
-set-endorsed-javafx-ant-classpath,-set-javafx-ant-classpath" if="do.check.ant-javafx.version">
<echo message="ant-javafx.jar.location = ${ant-javafx.jar.location}" level="verbose"/>
<echo message="javafx.ant.classpath = ${javafx.ant.classpath}" level="verbose"/>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpath="${javafx.ant.classpath}"/>
<condition property="have-fx-ant-init">
<typefound name="javafx:com.sun.javafx.tools.ant:init-ant"/>
</condition>
<property name="ant-javafx-version-already-checked-in-jfximpl" value="true"/>
<echo message="have-fx-ant-init = ${have-fx-ant-init}" level="verbose"/>
</target>
The error message is:
/home/chris/Projects/Java/FXMLTimer/nbproject/jfx-impl.xml:3438: The following error occurred while executing this line:
/home/chris/Projects/Java/FXMLTimer/nbproject/jfx-impl.xml:406:
java.lang.UnsupportedClassVersionError: com/sun/javafx/tools/ant/Permissions : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1136)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1307)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1362)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1323)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1076)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:579)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:237)
at org.apache.tools.ant.taskdefs.Antlib.execute(Antlib.java:180)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:428)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:277)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor169.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor169.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 7 seconds)
Does anyone have an idea what I'm missing? Is there a bug in NetBeans or in the 1.8.0_60 SDK or JRE? Thanks for your time & consideration!
You have to change netbeans_jdkhome in netbeans.conf file.
Source + more detailed information: https://joanpaon.wordpress.com/2013/06/11/how-to-change-netbeans-default-java-platform-2/