Why isn't JavaFX on the jdk1.7.0_u10build12 class path?

Scott Palmer swpalmer at gmail.com
Tue Oct 23 20:04:54 PDT 2012

I'm no Maven expert (in fact I hate it with a passion - it's fragile half-baked plugins broke the build on me just today) but what I suggested would continue to work without modifications after the proper co-bundling would it not?

The issue with including jfxrt.jar yourself is the fragile nature of the native code loading.  You must ensure the native libraries are at exactly the right relative path to jfxrt.jar.  If they aren't you might accidentally pick up the native libraries in the JRE folder and be fooled into thinking things are working.  Then when the JRE is updated the native libraries don't match your bundled jfxrt.jar and it breaks.  It happened to me :-) 
If you are't going to require 7u7 or later, it is probably best to use the javafxpackager tools somehow.


On 2012-10-23, at 10:55 PM, Daniel Zwolenski <zonski at gmail.com> wrote:

> Given that the bootclasspath issue will (one day) be fixed so that JFX is actually co-bundled, I'd personally just go with manually 'fixing' your installed JDK by moving JFX inside the JDK extension package after the install:
>     http://www.zenjava.com/firstcontact/architecture/setup/install-javafx/
> Then when the classpath issue finally gets resolved, no changes will be needed to your Maven POM etc. 
> If you use the assembly tools (or https://github.com/zonski/javafx-maven-plugin) then JFX gets bundled into the disputables so no need to do any hackery on that side of things (i.e. you only have to do the above cludge on your own dev machine where you do your compiling/building). 
> On Wed, Oct 24, 2012 at 1:00 PM, Scott Palmer <swpalmer at gmail.com> wrote:
> JavaFX has been bundled since 7u7 anyway… but it is not on the classpath by default.  Presumably someone was scared of breaking stuff.  The JavaFX app packager does some magic to get it on the classpath for runtime.
> For Maven there are a couple of options.  One is to use the dreaded "system" scope:
>         <dependency>
>                 <groupId>javafx</groupId>
>                 <artifactId>jfxrt</artifactId>
>                 <scope>system</scope>
>                 <systemPath>${java.home}/lib/jfxrt.jar</systemPath>
>                 <version>2.2.4</version>
>         </dependency>
> Use the "enforcer" plugin to require at lest 7u7.
>   <build>
>           <plugins>
>                   <plugin>
>                           <groupId>org.apache.maven.plugins</groupId>
>                           <artifactId>maven-enforcer-plugin</artifactId>
>                           <executions>
>                                   <execution>
>                                           <id>enforce-java</id>
>                                           <goals>
>                                                   <goal>enforce</goal>
>                                           </goals>
>                                           <configuration>
>                                                   <rules>
>                                                           <requireJavaVersion>
>                                                                   <version>1.7.0-7</version>
>                                                           </requireJavaVersion>
>                                                   </rules>
>                                           </configuration>
>                                   </execution>
>                           </executions>
>                   </plugin>
>           </plugins>
>   </build>
> (see http://maven.apache.org/plugins/maven-enforcer-plugin/rules/requireJavaVersion.html)
> And then do the same sort of classpath hackery that the app packager stubs do for runtime.  Or just use -Xbootclasspath/a:
> Scott
> On 2012-10-23, at 9:37 PM, Randahl Fink Isaksen <randahl at rockit.dk> wrote:
> > I upgraded to jdk 7u10 build 12 and I can see it comes with a JavaFX 2.2.4 inside it. So I thought I would go ahead and remove my maven dependency on the trusty old JavaFX 2.2.0-b19.
> >
> > However when I try to build my application with NetBeans it does not find the JavaFX classes. If I open the Java platform manager in NetBeans it also shows that jfxrt.jar is not on the class path of the JDK 1.7 (default) platform.
> >
> > Am I supposed to still extract the jfxrt.jar and the dylibs and manually create a maven dependency, or have I overlooked something here?
> >
> > Thanks
> >
> > Randahl

More information about the openjfx-dev mailing list