Can't restart my app with the latest JDK, regression.

Davide Perini perini.davide at dpsoftware.org
Tue Feb 6 09:33:48 UTC 2024


Thank you for sharing this info,
I think it can be very interesting for the JavaFX community since most 
of us use JPackage to bundle our JavaFX apps :)

Regards,
Davide

Il 05/02/2024 20:03, Kevin Rushforth ha scritto:
> For others who might be curious, Davide filed a bug via 
> bugreport.java.com and it is now available here:
>
> https://bugs.openjdk.org/browse/JDK-8325203
>
> It is almost certainly a bug in jpackage.
>
> -- Kevin
>
>
> On 2/5/2024 2:01 AM, Davide Perini wrote:
>> Hi John,
>> thanks for the answer.
>>
>> The problem happen even with other JDKs like the Azul, corretto...
>>
>> The weird thing is that to reproduce it you need to package the 
>> program with jpackage and then execute the program using the 
>> generated exe.
>>
>> This is the only code needed to reproduce the issue.
>>
>> public static void main(String... args) throws IOException {
>>          String[] cmdToRunUsingArgs = {"cmd.exe", "/C", "C:\\Program Files\\Notepad++\\notepad++.exe"};
>>          Runtime.getRuntime().exec(cmdToRunUsingArgs);
>>          Executors.newSingleThreadScheduledExecutor().schedule(() -> {
>>              System.exit(0);
>>          }, 30, TimeUnit.SECONDS);
>>      }
>>
>> It's very weird because the problem does not happen with the previous 
>> minor version of the JDK21, the JDK 21.01_12.
>>
>> I'm pretty sure now that this isn't related to JavaFX since the 
>> problem can be reproduced even without JavaFX.
>>
>> Problem must be in the JPackage.
>>
>> Thanks
>> Davide
>>
>>
>>
>> Il 04/02/2024 18:17, John Hendrikx ha scritto:
>>>
>>> Hi,
>>>
>>> Does that Temurin build contain JavaFX, or is it just a new Temurin 
>>> build?  Did you change anything else besides the JDK used?  You 
>>> could try other JDK's (openjdk, corretto, etc) as well.
>>>
>>> Is there anything being logged that may indicate what went wrong?
>>>
>>> That all said, it seems really unlikely this is related to JavaFX.
>>>
>>> If System.exit(0) is killing both the new and old application, then 
>>> it wasn't really spawned independently, so you can look into that 
>>> (you could put a delay there, and see with a tool like `top` or Task 
>>> Manager says, and see whether the restarted app is a child process 
>>> or not).
>>>
>>> It's also possible the problem is in the tools/settings used to 
>>> create the ".exe", so see if you changed anything there.
>>>
>>> For more info, tips or other ways of doing restarts: 
>>> https://stackoverflow.com/questions/4159802/how-can-i-restart-a-java-application
>>>
>>> --John
>>>
>>>
>>> On 04/02/2024 02:49, Davide Perini wrote:
>>>> Hi there,
>>>> my JavaFX 21.0.2 app experienced a very weird regression when 
>>>> switching from Temurin
>>>> OpenJDK21U-jdk_x64_windows_hotspot_21.0.1_12
>>>> to
>>>> OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13
>>>>
>>>> I use this method to restart my app.
>>>>
>>>> public void restart() {
>>>>      // path to my exe app plus one string argument
>>>>      String[] cmdToRunUsingArgs = {"C:\Users\sblantipodi\AppData\Local\Firefly Luciferin\Firefly 
>>>> Luciferin.exe","string argument"};
>>>>      try {
>>>>          Runtime.getRuntime().exec(cmdToRunUsingArgs);
>>>>      }catch (SecurityException | IOException e) {
>>>>          log.error(e.getMessage());
>>>>      }
>>>>      javafx.application.Platform.exit();
>>>>      System.exit(0);
>>>> }
>>>>
>>>> It worked well since years until JDK 21.0.2_13.
>>>> If I revert back to 21.0.1_12 it works well.
>>>>
>>>> That method should start a new instance of the app, and close the 
>>>> "old instance".
>>>>
>>>> With JDK 21.0.2_13, it closed the running instance but does not 
>>>> open a new instance.
>>>>
>>>> I don't know if open a bugreport to JDK but before opening the bug 
>>>> report I would like to ask you if that method to restart the app is 
>>>> correct or if you think that I can use a better way.
>>>>
>>>> Thanks
>>>> Davide
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240206/7fb3a708/attachment-0001.htm>


More information about the openjfx-dev mailing list