Steve On Java

Hacking JavaFX and Java with Agility
  • rss
  • Home
  • About
  • Contact
  • SvJugFX
  • Prize Spinner

Hacking JavaFX 1.0 to use Java 1.6 Features

steveonjava | January 2, 2009

Mark Chance was the first lucky user of JFXtras who ran into the JRE version issue when compiling the code. He had installed the latest version of Netbeans and configured a 1.6 JavaFX library, but was still getting “object not found” exceptions on 1.6-only classes. What was he doing wrong?

It turns out that the JavaFX 1.0 SDK ships with a slimmed down copy of rt15.jar in the lib/desktop folder, which ends up in the javafxpackager’s classpath for code compilation. This doesn’t have any of the new classes introduced in 1.6 such as SwingWorker, SystemTray, or even String.isEmpty(). However, if you plan to take advantage of any of the cool features of Java 1.6 like transparency or shaped windows, chances are that you require Java SE 6 anyway.

Here is how you hack the JavaFX 1.0 SDK to build against Java 1.6:

  1. Go to the installation directory of your 1.6 JRE and copy lib/rt.jar
  2. Find your JavaFX SDK installation directory and go to lib/desktop
  3. Delete or rename the existing rt15.jar file
  4. Paste the 1.6 rt.jar from step 1 into this folder, renaming it to rt15.jar

And that is it, you can now compile Java and JavaFX code with the javafxpackager that depends on 1.6-only features!

One important note for NetBeans users: Make sure to also update the rt15.jar in the JavaFX installation that comes bundled with NetBeans 6.5. If you forgot to do this, any projects that use the default JavaFX SDK will fail to compile.

 
Comments
15 Comments »
Categories
Uncategorized
Comments rss Comments rss
Trackback Trackback

Publications

The most comprehensive book on the JavaFX Platform!

Free Refcard covering JavaFX 1.2

Categories

  • Announcements (11)
  • contest (3)
  • Events (14)
  • JavaFX (29)
  • JavaFX Mobile (1)
  • jfxtras (9)
  • Liferay (2)
  • presentation (4)
  • pro javafx (2)
  • SvJugFx (6)
  • Uncategorized (21)
  • Video (2)
  • widgetfx (9)

Affiliations

Awards

2009 JavaOne Rock Star!

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox