rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Configure Java Product with Module Path

Fri May 06, 2022 2:01 pm

Hi,

I'm using Advanced Installer 19.4.

I hava a java app which uses JDK17 and JavaFX. For this reason i need to supply some special parameters to the java command:

Code: Select all

 
 -p path/to/modules --add-modules ... --add-exports ... --add-opens ...
If I don't supply those parameters and i try to start the application via the generated shortcut, no error message appears. In fact nothing seems to happen then.

If I supply those parameters as "Virtual Machine parameters" and try to start the app I get an error dialog which says:

"JNI Exception: failed to create the Java VM, Unknown reason"

Of course I can start my app happily from the command line (which contains my custom VM parameters).

what can I do?

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Configure Java Product with Module Path

Tue May 10, 2022 1:32 pm

Hello and welcome to our forums,

Unfortunately, I can not say for sure why that happens.

Is the issue happening only when you launch your Java application through the shortcut, or the same happens if you go to the installation folder and launch it from there?

If possible, could you please forward me the following resources:

- a copy of your .AIP file

- a download link for your setup

by e-mail at support at advancedinstaller dot com, so I can further investigate this?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Re: Configure Java Product with Module Path

Mon Sep 26, 2022 11:59 am

Hello again! I want to pick up this topic again.

I'm using a fairly new version of advanced installer (19.8.x)

I "think" the reason for this problem is that advanced installer java launcher can't parse arguments to the jre with two dashes, for example:

Code: Select all

--add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
or any other argument with '

Code: Select all

--
' in front of it I'm afraid.

My current workaround is to use a jre which contains the javafx classes. Azul provides such builds for example. See https://www.azul.com/downloads/?package=jdk

Without the parameters the launcher just starts the java process and there you go.

Maybe this is enough to reproduce the issue?

rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Re: Configure Java Product with Module Path

Tue Sep 27, 2022 4:57 am

Sorry, didn't reply to your questions:
Is the issue happening only when you launch your Java application through the shortcut, or the same happens if you go to the installation folder and launch it from there?
It is the same. The problem is that the launcher just exits with an error message.

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Configure Java Product with Module Path

Fri Sep 30, 2022 12:11 pm

Hello,

I have run a few tests on my end, but I'm afraid I was not able to reproduce the behavior you described.

Truth be told, I'm no Java expert, so that might be a reason why.

If possible, please forward me the following resources:

- a copy of your .AIP file

- a download link for the setup

- some details about the application and, if needed, what prerequisites I should download in order to reproduce this. Additionally, it would be great if you could give me some details about the workaround as well.

by email at support at advancedinstaller dot com so I can run some tests and further investigate this on our end.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Re: Configure Java Product with Module Path

Mon Oct 03, 2022 2:44 pm

Ok I'll try to set up a simple example.

Off topic: is there a way to configure this board to send a mail if somebody answers the question? :roll:

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Configure Java Product with Module Path

Tue Oct 04, 2022 11:25 am

Hello,
Ok I'll try to set up a simple example.
Sure thing!
Off topic: is there a way to configure this board to send a mail if somebody answers the question?
Yes, there is.

First of all, you should "Subscribe" to this thread:
Screenshot_10.png
Screenshot_10.png (43.27KiB)Viewed 15006 times
Then, you should enable the email option for the "subscribed" threads:
Screenshot_9.png
Screenshot_9.png (121.65KiB)Viewed 15006 times
(by clicking the bell icon)

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Re: Configure Java Product with Module Path

Tue Oct 04, 2022 1:46 pm

I just sent an email to your support team. Hope we'll find a solution together!

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Configure Java Product with Module Path

Thu Oct 06, 2022 2:16 pm

Thank you for providing the resources!

I will followup on this thread once I will be done investigating.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

rladstaetter
Posts: 11
Joined: Fri May 06, 2022 1:15 pm

Re: Configure Java Product with Module Path

Sat Oct 08, 2022 5:37 pm

I have solved this issue for me now by not using the java module path at all. I created an example project here:

https://github.com/rladstaetter/javafx- ... er-example

the trick is to launch the JavaFX application without using the module path. So far this seems to work, but I'm afraid this way of doing things is not how it should be. (?)

As far as I can tell the problem with the module path and advanced installer's exe launcher is a real one and needs a solution. Java applications will be modularized in the future, maybe the classpath way will even be deprecated and removed from future jdks ... :?

Catalin
Posts: 6510
Joined: Wed Jun 13, 2018 7:49 am

Re: Configure Java Product with Module Path

Tue Oct 11, 2022 1:24 pm

Hello,

I have followed up with our customer over the email for this, but in case anyone else will be stumbling upon this issue in the future - the problem was how the parameters were passed to the JVM, e.g.:

the user was passing them like this:

Code: Select all

--module-path jfx/ --add-modules javafx.controls,javafx.fxml --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
while they should have been passed like this:

Code: Select all

--module-path=jfx/ --add-modules=javafx.controls,javafx.fxml --add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
Additionally, if you want to launch the executable through a shortcut, please make sure you check the "Set product folder as current" from the "Java" page --> your product --> "Settings" tab.
Screenshot_12.png
Screenshot_12.png (39.23KiB)Viewed 14157 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”