0

On Oracle's website it is mentioned that for the JavaFX API, JDK SE 7 is required as it comes with JDK 7 or higher.

I have already downloaded and installed JDK SE 7 but i'm having a problem.

When I write the following code

import javafx.*   
class A {  
    public static void main(String[] args)  
    {  
        System.out.println("hi")  
    }
}

I'm getting a compiler error "package javafx does not exist" Also in my JDK folder I couldn't see the package "javafx" as it is the case with other packages like "java" or "javax" There's no issue with path(till bin) and classpath(till lib), I have set it correctly as I'm able to compile and run other programs, how can I sort this out?

xlm
  • 6,854
  • 14
  • 53
  • 55
user3367768
  • 17
  • 1
  • 6

1 Answers1

1

I've been able to successfully build your code by placing the jfxrt.jar into the project's build path.

This JAR is located where you installed your JDK, i.e. C:\Program Files\Java\jdk1.7.0_21\jre\lib\jfxrt.jar.

To add this to your project's build path on Eclipse, right click your project -> Build Path -> Configure Build Path... -> Add External JARS...

xlm
  • 6,854
  • 14
  • 53
  • 55