Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK 11 and JavaFX 11: build for ARM (Tinker Board) not running (hash mismatch)

I have a JavaFX 8 project which I develop on Windows 10 with NetBeans 8.2. The JAR I build from this I have running on an Asus Tinker Board.

With JDK 11 and JavaFX 11 I want to take advantage of a few of the new features and hope for some performance gain. After installing NetBeans 10 and with the help of the tutorial: https://openjfx.io/openjfx-docs/#introduction (section JavaFX and NetBeans > Non-modular with Maven), I have successfully ported and can run the application on my Windows system.

Either via the IDE or with the command prompt: java --module-path %PATH_TO_FX% --add-modules=javafx.c ontrols,javafx.fxml,javafx.graphics,javafx.media -jar Praatpaal2-2.0-jar-with-dependencies.jar

Compared to JavaFX 8, the JavaFX modules are now added as modules.

But when I do the same on the Asus Tinker Board (runnning Tinker OS (Debian)), I get the following error:

Error occurred during initialization of boot layer java.lang.module.FindException: Hash of javafx.base (d87df23ee5c54c7ff062c4f8572bab8aaf6c1775854662008fccdb993957bcad) differs to expected hash (320c5b0ffaf22fec9daf0c3e364f6598631b333fa95015a0f055e1c1c597c05b) recorded in java.base

There is very little information on this hash mismatch. My suspicion is that it either tries to load the Windows version of javafx.base.jar, or I use org.openjfx in the Maven pom.xml but refer to GluonHQ JavaFX on runtime, or there is something wrong with the modular setup I have.

The dependencies and build part of the pom.xml look like this:

<dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11.0.2</version>
            <classifier>win</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
            <classifier>win</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>11.0.2</version>
            <classifier>win</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
            <version>11.0.2</version>
            <classifier>win</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11.0.2</version>
            <classifier>linux</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
            <classifier>linux</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>11.0.2</version>
            <classifier>linux</classifier>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
            <version>11.0.2</version>
            <classifier>linux</classifier>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.8.1</version>
        </dependency>
        <dependency>
            <groupId>net.samuelcampos</groupId>
            <artifactId>usbdrivedetector</artifactId>
            <version>2.0.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>nl.embeddedfitness.praatpaal2.Main</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <archive>
                            <manifest>
                                <mainClass>
                                    nl.embeddedfitness.praatpaal2.Main
                                </mainClass>
                            </manifest>
                            </archive>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

I have tried the 4 JavaFX dependencies with and without classifier. But this makes no difference. The jar-with-dependencies builds the jar with all dependencies except the JavaFX ones which I add on runtime with the java command I mentioned earlier.

For Java 11 I use:
https://bell-sw.com/pages/java-11.0.2
Microsoft Windows 64 bit for the Windows system
Linux ARMv7&8 32 Bit HardFloat for the Asus Tinker Board

For JavaFX 11 I use:
https://gluonhq.com/products/javafx/
JavaFX Windows SDK for the Windows system
JavaFX armv6hf SDK for the Asus Tinker Board

like image 492
Fleximex Avatar asked Mar 22 '19 09:03

Fleximex


1 Answers

With the help of José Pereda I remembered I installed the lite version of Bellsoft JDK without the JavaFX modules. I now have the full version with those modules. I assumed I didn't need those since I would refer to the GluonHQ Java FX packages (--add-modules) anyway.
Bellsoft does not contain JavaFX Media so I will now try to use the Bellsoft JDK Java FX modules but add only the Media via --add-modules, though it may be that Media simply does not exist/work for ARM (yet).

like image 102
Fleximex Avatar answered Nov 15 '22 01:11

Fleximex