Fred Little
Fred Little

Reputation: 61

Problem: Gluon javafx project successfully generates .exe and .msi without errors, but program fails to run

When generated or installed .exe file double clicked, hour glass icon shows breifly and disappears and nothing happens, but should display window with user interface.

Able to execute mvn gluonfx:build, compile, link, and package only from x64 Native Tools Command Prompt after executing cmd.exe /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat".

Am able to run program from within the IDE via gluonfx:run and javafx:run, but unable to execute gluonfx:build or any other task from within the IDE. The build goal gives [ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:compile (default-cli) on project gwebbe: Error: Cannot run program "cl" (in directory "C:\Users\donne\Documents\GwebBe\target\gluonfx\x86_64-windows\gvm\GwebBe"). And of course other goals cannot be run from IDE.

The project was ported from a windows 10 to 11 computer late in 2022. I have carefully studied the GLUON documentation at https://docs.gluonhq.com including https://docs.gluonhq.com/#_introduction, https://docs.gluonhq.com/#_the_gluon_plugin_for_intellij_idea, and https://docs.gluonhq.com/#_goals.

One thing I know about that needs fixing is that my IDE is currently using Gluon Plugin for Intellij version 2.8.6, but my pom.xml is still showing the plugin as 1.0.15, which is also in my .m2 repository. When I attempt to change the pom.xml gluon plugin version to 2.8.6 I get an error and don't know how to fix it. Nor do I know how to revert the current 2.8.6 plugin back to 1.0.15.

Below is detailed data on project OS, IDE, pom.xml, environment variables. And I have included an image of the project structure.

Any assitance would be greatly appreciated.

OS: Windows 11, x64 Intellij 2022.3 Gluon Plugin 2.8.6 (But POM.XML properties shows <gluonfx.plugin.version>1.0.15</gluonfx.plugin.version> DOES THIS MATTER?

Project Gluon Single View Project, named GWebBe

Project settings: Java SDK 17, Modules: Project SDK (Oracle OpenJDK version 17.0.2) Platform settings: Oracle OpenJDK version 17.0.2

Environment variables: JAVA_HOME C:\jdk-17.0.2 GRAALVM_HOME C:\Program Files\GraalVM\graalvm-svm-java17-windows-gluon-22.1.0.1-Final

MAVEN System variables: M2_HOME C:\maven\apache-maven-3.8.6 MAVEN_HOME C:\maven\apache-maven-3.8.6 path %M2_HOME%\bin, %MAVEN_HOME%\bin, etc.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>org.gweb</groupId>
    <artifactId>gwebbe</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>GwebBe</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>11</maven.compiler.release>
        <javafx.version>17</javafx.version>
        <attach.version>4.0.16</attach.version>
        <gluonfx.plugin.version>1.0.15</gluonfx.plugin.version>
        <javafx.plugin.version>0.0.8</javafx.plugin.version>
        <mainClassName>org.gweb.GwebBe</mainClassName>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq</groupId>
            <artifactId>charm-glisten</artifactId>
            <version>6.2.2</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>display</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>lifecycle</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>statusbar</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>storage</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>util</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.10</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>17</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>22.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.sdk</groupId>
            <artifactId>graal-sdk</artifactId>
            <version>22.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>22.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.lookfirst</groupId>
            <artifactId>sardine</artifactId>
            <version>5.10</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>Gluon</id>
            <url>https://nexus.gluonhq.com/nexus/content/repositories/releases</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>

            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>${javafx.plugin.version}</version>
                <configuration>
                    <mainClass>${mainClassName}</mainClass>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.gluonhq</groupId>
                <artifactId>gluonfx-maven-plugin</artifactId>
                <version>${gluonfx.plugin.version}</version>
                <configuration>
                    <!--suppress UnresolvedMavenProperty -->
                    <target>${gluonfx.target}</target>
                    <attachList>
                        <list>display</list>
                        <list>lifecycle</list>
                        <list>statusbar</list>
                        <list>storage</list>
                    </attachList>
                    <mainClass>${mainClassName}</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ios</id>
            <properties>
                <gluonfx.target>ios</gluonfx.target>
            </properties>
        </profile>
        <profile>
            <id>android</id>
            <properties>
                <gluonfx.target>android</gluonfx.target>
            </properties>
        </profile>
    </profiles>
</project>

Project structure

Upvotes: 0

Views: 225

Answers (1)

Fred Little
Fred Little

Reputation: 61

As pointed out in comments, running mvn gluonfx:nativerun revealed that there was indeed an error in the code reported as "no awt in java.library.path at editnodes.TextEditor.getTextEditor(TextEditor.java:647)". And as @Jose Pereda points both GraalVM and GluonFX do not support awt at all. By commenting out several lines of code to remove all references to awt and then generating the package goal, the program runs sucessflully and displays the user interface. Problem resolved.

Upvotes: 0

Related Questions