如何修复'工作空间中没有安装与该环境严格兼容的JRE。 '?

时间:2019-10-10 14:38:32

标签: javafx

我下载了JavaFX Scene Builder 2.0,然后在Eclipse中创建了一个新的JavaFX Project。

不幸的是,发生此错误:

  

导入的Javafx无法解析

日志下方:

Eclipse version : 2019-09
JDK version : 13

Problem Description

Application cannot be resolved to a type
BorderPane cannot be resolved to a type
BorderPane cannot be resolved to a type
Scene cannot be resolved to a type
Scene cannot be resolved to a type
Stage cannot be resolved to a type
The import javafx cannot be resolved
The import javafx cannot be resolved
The import javafx cannot be resolved
The import javafx cannot be resolved
The method launch(String[]) is undefined for the type Main

Warnings
Build path specifies execution environment JavaSE-12. There are no JREs installed in the workspace that are strictly compatible with this environment.  hello       Build path  JRE System Library Problem

Console
Error: Unable to initialize main class application.Main
Caused by: java.lang.NoClassDefFoundError: Stage

我已经下载了e(fx)clipse 3.6.0

package application;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;


public class Main extends Application {


    @Override
    public void start(Stage primaryStage) {

    try{

    BorderPane root = new BorderPane();
            Scene scene = new Scene(root,400,400);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.show();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {


    launch(args);
    }
}

0 个答案:

没有答案