Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commandlineArgs doesn't work with javafx:jlink goal #176

Open
Martin819 opened this issue Oct 22, 2023 · 1 comment
Open

commandlineArgs doesn't work with javafx:jlink goal #176

Martin819 opened this issue Oct 22, 2023 · 1 comment

Comments

@Martin819
Copy link

Martin819 commented Oct 22, 2023

I have defined the commandlineArgs parameter, but it's never added to launcher.

I'm using Java 17 on Linux.

Configuration:

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.8</version>
    <configuration>
        <stripJavaDebugAttributes>true</stripJavaDebugAttributes>
        <compress>2</compress>
        <noHeaderFiles>true</noHeaderFiles>
        <noManPages>true</noManPages>
        <launcher>appName</launcher>
        <options>-Xmx7G -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx</options>
        <commandlineArgs>test1 test2</commandlineArgs>
        <jlinkImageName>appImageName</jlinkImageName>
        <jlinkZipName>appName_${project.version}</jlinkZipName>
        <mainClass>com.example/com.example.App</mainClass>
        <jlinkVerbose>false</jlinkVerbose>
        <jmodsPath>${project.build}/dependency</jmodsPath>
    </configuration>
</plugin>

Expected launcher:

#!/bin/sh
JLINK_VM_OPTIONS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx"
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m com.example/com.example.App test1 test2 "$@"

Actual launcher:

#!/bin/sh
JLINK_VM_OPTIONS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.virtualKeyboard=javafx"
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m com.example/com.example.App "$@"
@trashgod
Copy link

trashgod commented Feb 27, 2024

If I understand correctly, <commandlineArgs> is a javafx:run option, which appears to work as expected. It looks like you can pass the same command-line parameters to the launcher via the shell special variable "$@":

./target/appImageName/bin/appName test1 test2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants