bell-sw / LibericaNIK

Native Image Kit
8 stars 0 forks source link

native image program in AWT-WINDOWS cannot be renamed #3

Open java71 opened 8 months ago

java71 commented 8 months ago

Context use -LIBERICA for java21 -OS WINDOWS -Application based on AWT for processing images

First, it seems impossible to build a static executable (no AWT in java library path) ! So I had to back up on dynamic build. My program is correctly built with a lot of DLL in the same directory For testing it, I open a "DOS like" CONSOLE. -When executing generated program -> OK it works (except a segmentation fault on System.exit(0)) !!! -But when renaming program (simply append a character to the name for instance), execution cannot be started -> "No awt in java.library.path"

Could you please:

Thanks!

petermz commented 8 months ago

Hi,

I can confirm the renamed program stops working, for reasons so far unclear to me. Thanks for reporting this!

System.exit() worked for me. Could you post your crash dump maybe?

On Windows, AWT libraries were linked dynamically for a long time, probably from the very beginning. Linux did static linking for some time, then converted to dynamic linking as well. This issue has some details. So it's the other way around -- we'll probably have more dynamic and less static linking over time.

java71 commented 8 months ago

Hi Peter,Thanks for your fast reply !1) OK for renaming, I am not the only one to have this problem !2) Considering System.exit(), no doubt that it works but when I use JavaFX "Platform.exit()" before System.exit(), there is a probabilistic behaviou:- Seems no problem when using JVM- From time to time (1/3 as an order of magnitude) there is a "blocking" and System.exit() is never reached. This behaviour seems like if there was a dead lock, or synchronization problem betweem JavaFX thread, and main Java thread.I did not take the time to produce a simple "hello world" with a simple frame because my development iis based on personnal painting method. I understand that without an example that reproduces the bug it is not easy... So I will take a bit more time to try to reproduce the problem...3) Considering static or dynamic linking, I feel so lonely :) ! The deployment or shipping of a program is so simpler with one single file. Native Image is a real progress, and I appreciate LIBERICA work, really ! Note that JVM is also a set of files !.OK I stop to complain ! Thank you for your answer. I dev in Java since its creation in 95, Maybe in 10/15 more years my early dream will come true. Note that except for jsound.dll LIBERICA NIK permit to build static image : thank you for that !!!envoyé : 22 janvier 2024 à 15:24de : Peter Zhelezniakov @.>à : bell-sw/Liberica @.>cc : java71 @.>, Author @.>objet : Re: [bell-sw/Liberica] native image program in AWT-WINDOWS cannot be renamed (Issue bell-sw/LibericaNIK#3) Hi,I can confirm the renamed program stops working, for reasons so far unclear to me. Thanks for reporting this!System.exit() worked for me. Could you post your crash dump maybe?On Windows, AWT libraries were linked dynamically for a long time, probably from the very beginning. Linux did static linking for some time, then converted to dynamic linking as well. This issue has some details. So it's the other way around -- we'll probably have more dynamic and less static linking over time.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Lilianne-Blaze commented 7 months ago

@java71 GraalVM generates shim dlls with hardcoded exe name. I've managed to create a workaround but I must warn you it's a bit of a sxxxshow and I don't have the time now to clean it up. It extracts and modifies shims and other dlls as needed. https://github.com/Lilianne-Blaze/demo-nativeimage-swing2