当我运行这段代码(请在下面找到我的代码片段)从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 10编译的jar (JFXtras中的主版本号表示最小Java版本)。
https://en.wikipedia.org/wiki/Java_class_file General_layout
你需要8.