So I am trying to run a simple helloworld app for the javafx but its packages cannot be found. Ok so must be some kind of path issue right?
I have downloaded the co-bundled version from here:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html
You would expect that a co-bundled would install just as the SE package installed. I have searched the net and people give windows answers with windows path's to a mac problem. Which is really IMO a java problem because either you co-bundle like you said you did and install both or keep them separate!
I have yet to find an appropriate solution to getting javafx to be included in the compile, that does not involve including long paths.
EDIT: After installing netbeans and creating a javafx project, it had no trouble locating the appropriate packages. I think at this point it should be clear that FX is co-bundled with the SE version however they ( java maintainers ) have decided to make it decidedly uneasy to get FX working from the command line. Any insight into this otherwise dumb decision?
Download the latest JavaFX SDK installer file for Windows (an EXE extension) or Mac OS X (a DMG extension). Download older versions of the JavaFX SDK installer from the Previous Releases download page. After the download is complete, double-click the EXE or DMG file to run the installer.
JavaFX 17.0. 2+ with support for M1 macs (aarch64 architecture) is available at the resources I linked in this answer.
JavaFX is not included in the JDK since Java 9 (with the exception of the Azul JDK, IIRC).
For JDK 11 and later releases, Oracle has open sourced JavaFX. You can find more information at OpenJFX project.
Some choices:
For 3 you can find jfxrt.jar for the jre under:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
If you have jdk7 installed, you can run a JavaFX app (packaged using the JavaFX deployment tools) from the command line using something like the following:
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
java -version
java -jar application.jar
If it is just the JRE7 installed and no JDK, then you can use:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar application.jar
Per option #3 in Jewelsea's answer, here's how it looked in my ant build file:
<property name="jfx.dir" value="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib"/>
<path id="project.class.path">
<pathelement path="${classpath}"/>
<pathelement location="${jfx.dir}/jfxrt.jar"/>
</path>
<target name="compile"
description="Compiles the source code.">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false"
srcdir="${src.dir}"
destdir="${classes.dir}">
<classpath refid="project.class.path"/>
<exclude name="**/package-info.java"/>
</javac>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With