I am trying to create a cross-platform JAR which contains:
- a command line application ("Tool")
- a JavaFX application ("Viewer")
I followed the solution of: Maven Shade JavaFX runtime components are missing and I created on Windows a JAR from which I can run both the Tool and the Viewer. I copied it to a Linux machine, and as I can still run the Tool in this way, the Viewer hangs, and does not even prints to the std out.
Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test</groupId>
    <artifactId>crossjavafx</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <name>${project.artifactId}</name>
    <description>${project.artifactId}</description>
    <properties>
        <java.version>1.11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>11</version>
            <classifier>win</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics </artifactId>
            <version>11</version>
            <classifier>linux</classifier>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.11</source>
                    <target>1.11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
simplified Tool.java:
package crossjavafx;
public class Tool {
    public static void main(String[] args) {
        System.out.println("Hello");
    }
}
simplified Viewer.java
package crossjavafx;
public class Viewer {
    public static void main(String[] args) {
        MainViewer.main(args);
    }
}
MainViewer.java
package crossjavafx;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainViewer extends Application {
    @Override
    public void start(Stage stage) {
        try {
            System.out.println("Hello from Viewer");
            Group root = new Group();
            Scene scene = new Scene(root, 400, 300);
            stage.setTitle("Hello");
            stage.setScene(scene);
            stage.show();
        } catch (final Exception e) {
            System.exit(1);
        }
    }
    public static void main(String args[]){
        launch(args);
    }
}
I am executing both applications:
java -cp crossjavafx-0.1.0-SNAPSHOT.jar crossjavafx.Tool // works on win and linux
java -cp crossjavafx-0.1.0-SNAPSHOT.jar crossjavafx.Viewer // works on win, hangs on linux 
Edit I have changed 1.8 to 1.11 below.
           <plugin>
                <configuration>
                    <source>1.11</source>
                    <target>1.11</target>
                </configuration>
           </plugin>
Eventually, I got the following error message when running Viewer on Linux:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fddc02dcf55, pid=20666, tid=20685
#
# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13-Ubuntu-3ubuntu116.04ppa1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13-Ubuntu-3ubuntu116.04ppa1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libGL.so.1+0x89f55]
On Windows I am using: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)
