I have installed jdk1.7.0_07 and changed PATH but i still cannot import javafx, is there something that i should do fix this?
Make sure that /jre/lib/jfxrt.jar is on your compile path.
For example for the 64 bit jdk7u6 version on win7, the jfxrt.jar is located here:
jfxrt.jar was left off of the java runtime path on purpose for jdk1.7.0_06 until further testing between JavaFX and rest of the java infrastructure has been completed. This means that non-JavaFX programs cannot possibly be impacted by possible compatibility issues which may be caused by JavaFX. To date I have never encountered any compatibility issue - this was just a cautious move by Oracle in this regard I believe.
In a future release the jfxrt.jar should be added to the default compile and runtime classpath for Java and some of the information below should be irrelevant. You can track the request to add jfxrt.jar to the default java runtime.
Compiling and Running a JavaFX program from the command line
Example below is for a JavaFX application class named
If you are compiling from a command line, compile with:
javac -cp ".;C:\Program Files\Java\jdk1.7.0_06\jre\lib\jfxrt.jar" javafxsamples/AudioPlaylist.java
To run from the command line, you can use:
java -cp ".;C:\Program Files\Java\jdk1.7.0_06\jre\lib\jfxrt.jar" javafxsamples.AudioPlaylist
Though, it is recommended that you package your applications with the javafxpackager, rather than manually adding jfxrt.jar to your classpath (javafxpackager packaged applications will embed a launcher which finds jfxrt.jar and adds it to the classpath for you).
javafxpackager -createjar -nocss2bin -appclass javafxsamples.AudioPlaylist -srcdir . -outfile AudioPlaylist.jar
After that you can run the app without needing to specify a jfxrt.jar location on the classpath:
java -jar AudioPlaylist.jar
Compiling and Running a JavaFX program using IDEs
If you are using NetBeans 7.2+, you can create a JavaFX project type and it should automatically find JavaFX jfxrt.jar and place it on your project's classpath when you set up jdk1.7.0_07 as your platform.
If you are using e(fx)clipse make sure you are using the latest version (0.0.14+) which is features better facilities for detecting JavaFX.
Intellij Idea 11.1.3 will automatically add all of the files from the jre lib directory to it's project classpath, so you shouldn't get compile errors with it. Note that Idea's behaviour is erroneous in this regard, it shouldn't really do this, but it in the end you end up with the expected behaviour of being able to compile and run your JavaFX classes from idea.
Building a JavaFX program using maven
An example of packaging JavaFX with maven is provided in this maven project.
Even if you use an IDE or Maven for your build, it is still recommended, you package your app for delivery using the javafx ant tasks or javafxpackager utility as this should provide the most robust deployment solutions for your application.