VMware Cloud Community
Lam_bui
Contributor
Contributor

Possible to build Java Launcher with OpenJDK and JavaFX?

Hello,
Some of our java programs required JavaFX. I was able to build a java launcher for Oracle JRE Java, but it's more complicated for OpenJDK with JavaFX. The cmd that we use is below and it work. Is there anyway I can build the java launcher with this?

java --module-path %PATH_TO_FX% --add-modules javafx.controls,javafx.fxml -cp "%CLASSPATH%;LauncherApp.jar" LauncherApp.LauncherAppMain

Reply
0 Kudos
7 Replies
michieldhont_
Hot Shot
Hot Shot

Hi @Lam_bui,

Could you try passing the parameters to the launcher's <arguments> and using the IB variable notation ${} for the variables?

      <javaLauncher>
         ...
        <arguments>--module-path ${path_to_fx) --add-modules javafx.controls,javafx.fxml -cp "${java_launcher_classpath};${java_launcher_jar}" </arguments>
        ...
      </javaLauncher>

Regards,

Michiel

Reply
0 Kudos
Lam_bui
Contributor
Contributor

Hi Michiel,

I got the error below, I try different path/ways, but I am still getting the same error. Not sure what I did wrong...?

Error: Could not find or load main class FASTTLauncher.FASTTMain
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

 

<setInstallerVariable name="path_to_fx" value="path_to_javafx_libs"/>

<javaLauncherList>
    <javaLauncher allowCommandLineArguments="1" binaryName="fasttapp" classpath="${path_to_classpath}" mainClass="FASTTLauncher.FASTTMain" runInConsole="1" workingDirectory="${path_to_dir}">
      <arguments>--module-path ${path_to_fx} --add-modules javafx.controls,javafx.fxml -cp "${java_launcher_classpath};FASTT.jar" FASTTLauncher.FASTTMain"</arguments>
  </javaLauncher>
</javaLauncherList>

 

 

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Lam_bui,

It seems you are already defining the classPath and the mainClass in the action, so you don't need to add them to the arguments. Also there seems to be an extra double quote. Could you try the following:

<setInstallerVariable name="path_to_fx" value="path_to_javafx_libs"/>

<javaLauncherList>
    <javaLauncher allowCommandLineArguments="1" binaryName="fasttapp" classpath="${path_to_classpath}" mainClass="FASTTLauncher.FASTTMain" runInConsole="1" workingDirectory="${path_to_dir}">
      <arguments>--module-path ${path_to_fx} --add-modules javafx.controls,javafx.fxml</arguments>
  </javaLauncher>
</javaLauncherList>

Regards,

Michiel

Reply
0 Kudos
Lam_bui
Contributor
Contributor

Hi Michiel,

Still getting that same error... where it cannot find the mainclass from your suggesting. I also tried to just put the whole cmd like below out, but same result.

<setInstallerVariable name="path_to_fx" value="path_to_javafx_libs"/>

<javaLauncherList>
    <javaLauncher allowCommandLineArguments="1" binaryName="fasttapp" runInConsole="1" workingDirectory="${path_to_dir}">
        <arguments>--module-path ${path_to_fx} --add-modules javafx.controls,javafx.fxml -cp "${path_to_classpath}" FASTTLauncher.FASTTMain</arguments>
    </javaLauncher>
</javaLauncherList>

 

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Lam_bui,

Could you run the installer with the --debugtrace option and contact us in private support?

\.installer.exe --debugtrace debug.txt

Regards,

Michiel

Reply
0 Kudos
Lam_bui
Contributor
Contributor

@michieldhont_ ,

This argument works, the problem was with my actual java jar app, thank you for your help.

Reply
0 Kudos
gongomgra
VMware Employee
VMware Employee

Hi @Lam_bui ,

Thanks for your message. We are glad your fixed your issue!

Reply
0 Kudos