javajavafxjfxtras

Exception "JavaFX Application Thread" while trying to run icalenderagenda from JFXtras


When I run this code (please find my code snippet below) to get the icalenderAgenda from JFXtras library, it throws an exception

"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, 

Can anyone tell me how to approach this problem.

NOTE: my java runtime version is version 8 build 1.8.0 , IDE=Netbeans8.2

Thank you!


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);
    }

}

Solution

  • You've downloaded a jar compiled with Java 10 (the major version number in JFXtras denotes the minimal Java version).

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

    You need 8.