I'm trying to follow this javafx 3d tutorial, however I get the following error (I cleared up several earlier errors by installing 32bit gtk2 packages and libraries), however this issue doesn't seem to be down to that. I have found nothing online with the same error.
Note: I don't have an fxml file (I don't think I need one as I set it all up in code)
Running ubuntu 16.04.3 Elementary OS Loki
Error message:
Gtk-Message: Failed to load module "pantheon-filechooser-module"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "canberra-gtk-module"
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
Code:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.PointLight;
import javafx.scene.Scene;
import javafx.scene.shape.Box;
import javafx.stage.Stage;
public class GraphicsApplication extends Application {
public void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Box box = new Box(100,100,100);
box.setTranslateX(150);
box.setTranslateY(100);
PointLight light = new PointLight();
light.setTranslateX(300);
light.setTranslateY(350);
light.setTranslateZ(200);
PerspectiveCamera camera = new PerspectiveCamera();
camera.setTranslateX(100);
camera.setTranslateY(-50);
camera.setTranslateZ(300);
Group root = new Group(box, light);
Scene scene = new Scene(root, 400, 200, true);
scene.setCamera(camera);
primaryStage.setScene(scene);
primaryStage.setTitle("Super test 5000");
primaryStage.show();
}
}
main()
method has to bestatic
.