JavaFX UnsupportedClassVersionError - Ant - Unsupported major.minor version 52.0

allapow

Mitglied
hallo wieder,

ich wollte mal mit JavaFX anfangen und habe folgende Startprobleme.
Zuerst meine Umgebung:
Ubuntu 14.04
Netbeans 8
Oracle Java JDK 8 (1.8.0_05) (auch in Netbeans konfiguriert ...Netbeans hat es erkannt)
Ant 1.9.3 (auch in Netbeans konfiguriert ...Netbeans hat es erkannt)

Mit Netbeans erstelle ich ein neues JavaFX Projekt (JavaFX Application) und versuche es direkt zu kompilieren und zu starten.
...und dann kommt das:
Code:
ant -f /home/allapow/NetBeansProjects/JavaFXApplication01 jfxsa-run
init:
Deleting: /home/allapow/NetBeansProjects/JavaFXApplication01/build/built-jar.properties
deps-jar:
Updating property file: /home/allapow/NetBeansProjects/JavaFXApplication01/build/built-jar.properties
compile:
/home/allapow/NetBeansProjects/JavaFXApplication01/nbproject/jfx-impl.xml:406: 
java.lang.UnsupportedClassVersionError: com/sun/javafx/tools/ant/Application : 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:1128)
	at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1299)
	at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1354)
	at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
	at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:270)
	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:177)
	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.GeneratedMethodAccessor52.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: 1 second)

Bevor ich das Ant 1.9.3 (Ubuntu Paket Install) in Netbeans konfiguriert hatte habe ich es auch mit dem default (1.9.2; von Netbeans) versucht ...selbe Fehlermeldung.
Hier frage ich mich schon wozu
Code:
Unsupported major.minor version 52.0
die 52 gehört. Ist das eine interne Bezeichnung für die Ant Version?

In
Code:
/home/allapow/NetBeansProjects/JavaFXApplication01/nbproject/jfx-impl.xml:406
ist dann eine Variable für den Classpath, aber weiter helfen tut mir das nicht. Ich weiß ja nicht wie ich mit der Fehlermeldung umgehen soll.

Kommt Ant mit Java 8 nicht klar?

Ich weiß nicht weiter ...wäre super wenn da jemand helfen könnte ...und wenn's nur 'n Stück ist.
 

allapow

Mitglied
ich liebe diesen Tip mit google ;)
...wenn du aber mit bestimmten Suchanfragen brauchbare Infos gefunden hast, bin ich auch dankbar für neue google-such-inputs.

Also Java 8 habe ich auch meinem Ubuntu zum Ausführen mitgeteilt:
Code:
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.8.0_05/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.8.0_05/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.8.0_05/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.8.0_05/bin/jar" 1

sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.8.0_05/bin/java"
sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.8.0_05/bin/javac"
sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.8.0_05/bin/javaws"
sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.8.0_05/bin/jar"
...ein
Code:
java -version
gibt mir dann das was ich oben gemacht habe.

Doch denke ich, dass das nichts mit dem Ausführen zu tun hat weils ja bei der Kompilierung erfolgt.
...oder wir verstehen uns falsch.
 
Zuletzt bearbeitet:

allapow

Mitglied
hmm, ok, aber warum nimmt Ant nicht das Java was alle (laut Ubuntu Einstellung) nehmen?

...ich steh auf'm Schlauch.

oder will Ant nicht mit Java 8?
 
Zuletzt bearbeitet:

allapow

Mitglied
Auszug aus der build.xml (jfx-impl.xml), wo der Fehler entsteht:
[XML]
<target name="-check-ant-javafx-in-fxsdk-lib" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
<condition property="do.set.ant-javafx.in.fxsdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-fxsdk-lib" depends="-check-ant-javafx-in-fxsdk-lib" if="do.set.ant-javafx.in.fxsdk.lib">
<property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-fxsdk-tools" depends="-check-property-javafx.sdk" if="javafx.sdk.defined">
<condition property="do.set.ant-javafx.in.fxsdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-fxsdk-tools" depends="-set-ant-javafx-in-fxsdk-lib,-check-ant-javafx-in-fxsdk-tools" if="do.set.ant-javafx.in.fxsdk.tools">
<property name="ant-javafx.jar.location" value="${javafx.sdk}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-platform-home-lib" if="platform.home">
<condition property="do.set.ant-javafx.in.platform.home.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-platform-home-lib" depends="-set-ant-javafx-in-fxsdk-tools,-check-ant-javafx-in-platform-home-lib" if="do.set.ant-javafx.in.platform.home.lib">
<property name="ant-javafx.jar.location" value="${platform.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-platform-home-tools" if="platform.home">
<condition property="do.set.ant-javafx.in.platform.home.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-platform-home-tools" depends="-set-ant-javafx-in-platform-home-lib,-check-ant-javafx-in-platform-home-tools" if="do.set.ant-javafx.in.platform.home.tools">
<property name="ant-javafx.jar.location" value="${platform.home}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-probjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-lib" depends="-set-ant-javafx-in-platform-home-tools,-check-ant-javafx-in-probjdk-lib" if="do.set.ant-javafx.in.probjdk.lib">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-probjdk-tools" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.probjdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-probjdk-tools" depends="-set-ant-javafx-in-probjdk-lib,-check-ant-javafx-in-probjdk-tools" if="do.set.ant-javafx.in.probjdk.tools">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}..${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-macjdk-lib" unless="ant-javafx.jar.location">
<condition property="do.set.ant-javafx.in.macjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-macjdk-lib" depends="-set-ant-javafx-in-probjdk-tools,-check-ant-javafx-in-macjdk-lib" if="do.set.ant-javafx.in.macjdk.lib">
<property name="ant-javafx.jar.location" value="${java.home}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-envjdk-lib" unless="ant-javafx.jar.location">
<property environment="env"/>
<condition property="do.set.ant-javafx.in.envjdk.lib">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-envjdk-lib" depends="-set-ant-javafx-in-macjdk-lib,-check-ant-javafx-in-envjdk-lib" if="do.set.ant-javafx.in.envjdk.lib">
<property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}lib${file.separator}ant-javafx.jar"/>
</target>
<target name="-check-ant-javafx-in-envjdk-tools" unless="ant-javafx.jar.location">
<property environment="env"/>
<condition property="do.set.ant-javafx.in.envjdk.tools">
<and>
<not><isset property="ant-javafx.jar.location"/></not>
<available file="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
</and>
</condition>
</target>
<target name="-set-ant-javafx-in-envjdk-tools" depends="-set-ant-javafx-in-envjdk-lib,-check-ant-javafx-in-envjdk-tools" if="do.set.ant-javafx.in.envjdk.tools">
<property name="ant-javafx.jar.location" value="${env.JAVA_HOME}${file.separator}tools${file.separator}ant-javafx.jar"/>
</target>
<target name="-pre-check-ant-javafx-version" depends="-set-ant-javafx-in-envjdk-tools" unless="ant-javafx-version-already-checked-in-jfximpl">
<condition property="do.check.ant-javafx.version">
<and>
<isset property="ant-javafx.jar.location"/>
<not><isset property="ant-javafx-version-already-checked-in-jfximpl"/></not>
</and>
</condition>
</target>
<target name="-set-endorsed-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" if="endorsed-javafx-ant-classpath-available">
<property name="javafx.ant.classpath" value="${endorsed.javafx.ant.classpath}:${ant-javafx.jar.location}"/>
</target>
<target name="-set-javafx-ant-classpath" depends="-check-endorsed-javafx-ant-classpath,-pre-check-ant-javafx-version" unless="endorsed-javafx-ant-classpath-available">
<property name="javafx.ant.classpath" value="${ant-javafx.jar.location}"/>
</target>
<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>
<target name="-check-jfx-sdk-version-old" depends="-check-ant-javafx-version" unless="have-fx-ant-init">
<property name="javafx.ant.version" value="1.0"/>
</target>
<target name="-check-jfx-sdk-version-new" depends="-check-ant-javafx-version" if="have-fx-ant-init">
<fx:init-ant/>
<condition property="have-fx-ant-api-1.1">
<!-- new features from JavaFX 2.0.2 are available in API version 1.1 or later -->
<matches pattern="1.[1-9]" string="${javafx.ant.version}"/>
</condition>
<condition property="have-fx-ant-api-1.2">
<!-- new features from JavaFX 2.2 are available in API version 1.2 or later -->
<matches pattern="1.[2-9]" string="${javafx.ant.version}"/>
</condition>
</target>[/XML]

Die Zeile 407 in der Fehlermeldung ist hier Zeile 122

Meiner Meinung nach müsste
Code:
${ant-javafx.jar.location}
das richtige finden (auch wenns scheinbar überall gesucht wird).

meine Umgebung:
in
Code:
JAVA_HOME/lib
liegt ant-javafx.jar
Code:
@allapow:~$ ls $JAVA_HOME/lib
amd64  ant-javafx.jar  ct.sym  dt.jar  ir.idl  javafx-mx.jar  jconsole.jar  jexec  missioncontrol  orb.idl  sa-jdi.jar  tools.jar  visualvm

Aber wirklich blicken tue ich das nicht :(

edit:
Da war ja noch die build-impl.xml ...ein Auszug:
[XML]<import file="jfx-impl.xml"/>
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
<not>
<antversion atleast="1.8.0"/>
</not>
</condition>
</fail>[/XML]
Ich finde das sieht gut aus.
 
Zuletzt bearbeitet:

Ähnliche Java Themen

Neue Themen


Oben