About implementing JavaFX.
The following error occurs in Eclipse:I've done my own research and prepared the following, but there's no change at all.
Please let me know if there are any improvements.
add
package application;
import org.gralvm.compiler.phases.common.NodeCounterPhase.Stage;
import com.apple.eawt.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
public class Main extensions Application {
@ Override
public void start (Stage primaryStage) {
try{
BorderPane root=new BorderPane();
Scenescene=new Scene(root,400,400);
screen.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exceptione){
e.printStackTrace();
}
}
public static void main(String[]args) {
launch(args);
}
}
The JavaFX SDK and GraalVM compiler libraries (jar files) are not set in the build path, so download them and add them to the build path.Also, some of the Main
classes seem to be calling methods that do not exist.
JavaFX SDK https://gluonhq.com/products/javafx/
GraalVM Compiler https://mvnrepository.com/artifact/org.graalvm.compiler/compiler/1.0.0-rc16
add
The import is strange.Where javafx classes should be imported,
import org.gralvm.compiler.phases.common.NodeCounterPhase.Stage;
import com.apple.eawt.Application;
Importing an unrelated class of the same name.Please change it to the following two lines.
import javafx.stage.Stage;
import javafx.application.Application;
Also, please remove the library of the GraalVM compiler from the build path.The build should now pass.
© 2024 OneMinuteCode. All rights reserved.