【问题标题】:Exception "JavaFX Application Thread" while trying to run icalenderagenda from JFXtras尝试从 JFXtras 运行 icalenderagenda 时出现异常“JavaFX 应用程序线程”
【发布时间】:2021-03-01 19:05:22
【问题描述】:

当我运行此代码(请在下面找到我的代码 sn-p)以从 JFXtras 库中获取 icalenderAgenda 时,它会引发异常

"Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.UnsupportedClassVersionError: jfxtras/scene/control/agenda/Agenda has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0, 

谁能告诉我如何解决这个问题。

注意:我的 java 运行时版本是 version 8 build 1.8.0 ,IDE=Netbeans8.2

谢谢!


import java.time.LocalDateTime;
import java.time.Period;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import jfxtras.labs.icalendaragenda.scene.control.agenda.ICalendarAgenda;
import jfxtras.labs.icalendarfx.VCalendar;

/**
 *
 * @author XY
 */
public class Testicalender extends Application {

    @Override
    public void start(Stage primaryStage) {

        BorderPane root = new BorderPane();
        VCalendar vCalendar = new VCalendar();
        ICalendarAgenda agenda = new ICalendarAgenda(vCalendar);
        root.setCenter(agenda);

        //semaine++ ou --
        Button increaseweek = new Button(">>");
        Button decreaseweek = new Button("<<");
        HBox buttonHbox = new HBox(decreaseweek, increaseweek);

//        increaseweek.setOnAction((e)->
//        
//        { LocalDateTime newDisplayedLocalDateTime = agenda.getDisplayedLocalDateTime().plus(Period.ofWeeks(1));
//        agenda.setDisplayedLocalDateTime(newDisplayedLocalDateTime);
//        });
//        decreaseweek.setOnAction((e)->
//        
//        { LocalDateTime newDisplayedLocalDateTime = agenda.getDisplayedLocalDateTime().minus(Period.ofWeeks(1));
//        agenda.setDisplayedLocalDateTime(newDisplayedLocalDateTime);
//        });
        Scene scene = new Scene(root, 1366, 786);
        primaryStage.setScene(scene);
        primaryStage.setTitle("test calendarAgenda");
        //primaryStage.setOnCloseRequest(e-> System.out.println(vCalendar.toContent()));
        primaryStage.show();

    }

//    /**
//     * @param args the command line arguments
//     */
    public static void main(String[] args) {
        launch(args);
    }

}

【问题讨论】:

    标签: java javafx jfxtras


    【解决方案1】:

    您已经下载了一个使用 Java 10 编译的 jar(JFXtras 中的主要版本号表示最小的 Java 版本)。

    https://en.wikipedia.org/wiki/Java_class_file#General_layout

    你需要 8 个。

    【讨论】:

    猜你喜欢
    • 2016-02-01
    • 2016-11-05
    • 1970-01-01
    • 2012-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-30
    相关资源
    最近更新 更多