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

Scott Palmer swpalmer at gmail.com
Tue Oct 23 19:00:07 PDT 2012


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