Reputation: 4649
I have created a bundled JavaFX application jar with ANT on Windows 8 O.S. , 64 bit machine. I have JavaFx2.0 and Java 1.7.0_09 installed on my Window O.S.
<target name="CreatingJars" depends="Compiling" description="generate the distribution" >
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
<mkdir dir="${WorkingFolder}/temp/libs"/>
<copy todir="${WorkingFolder}/temp/libs">
<fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
</fileset>
</copy>
<copy todir="${WorkingFolder}/temp/libs">
<fileset dir="${WorkingFolder}/libs">
</fileset>
</copy>
<fx:jar destfile="${WorkingFolder}/${app.name}.jar">
<fx:application mainClass="${main.class}"/>
<fx:resources>
<fx:fileset dir="${WorkingFolder}/temp/"/>
</fx:resources>
<fileset dir="${WorkingFolder}/build"/>
<fileset dir="${WorkingFolder}/resources"/>
</fx:jar>
</target>
When I am trying to run that JavaFX application jar on MAC OS Lion 10.7.5 using
java -jar application.jar
It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
java -version is always point to 1.6.
Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?
Upvotes: 1
Views: 1812
Reputation: 159341
See related forum post.
To run the app for the latest installed Oracle jre version:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar application.jar
To run the app for a given installed jdk version:
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
java -jar application.jar
Upvotes: 1