Javafx application cannot find the liberay


In my eclipse i have followed the following steps:

  1. New -> Other -> Javafx project

  2. Name the project i.e "TestJavaFx"

  3. Create new class "Main"

write the following code:

    public class Main extends Application{

     * @param args
    public static void main(String[] args) {
        // TODO Auto-generated method stub



And i get an error saying:

Application cannot be resolved to a type

And there is no import.

it looks like i don't have the lib. But how can i create a new Javafx project without having the lib?

How do i fix this?

8/6/2013 8:34:52 AM

First in Eclipse you need add jfxrt.jar to project's libraries (It is located in Jre lib folder).

Then you need to override Application's abstract method start

public void start(Stage primaryStage) {;

Here is a minimal example:

import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {

    public void start(Stage primaryStage) {;

    public static void main(String[] args) {
8/6/2013 1:24:54 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow