I'm trying to learn JavaFX in combination with a Raspberry Pi with the OS Raspian (Jessie). Right now I'm coding in IntelliJ IDE with a basic example of JavaFX. My Windows 10 PC is using the newest SDK. 8.0 JDK. The Raspian is using 8.0
When I compile the software on my Windows PC I'm getting a .jar File. I made sure that the Artifacts are correct and linked to the main class of the package. The problem what I expecting is when I run the .jar on the Raspberry that I'm getting the following error:
Error: Could not find or load Main class sample.Main
The command that I'm executing:
java -jar care.jar
I made sure that the JDK is installed correctly. The Java package should be compiled right for Linux.
The code that I'm using is a standard example of IntelliJ. sample.Main
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
sample.fxml
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane fx:controller="sample.Controller"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>
I tried to add the .class files in the same directory of the .jar file. But with no luck.