See Setting up GTK for Windows
pacman -S mingw-w64-x86_64-gtk4
pacman -S mingw-w64-x86_64-libadwaita
pacman -S mingw-w64-x86_64-gstreamer
- Add
C:\msys64\mingw64\bin
to thePATH
environment variable - Add
-Dfile.encoding=UTF8
to theJAVA_TOOL_OPTIONS
environment variable.
git clone https://github.com/bailuk/java-gtk.git
cd java-gtk
.\gradlew.bat generate
.\gradlew.bat build
.\gradlew.bat run
GTK for Windows has a different naming schema for libraries than assumed by default. Default library names are configured in Configuration.kt. Alternative names are configured in loader.properties. More alternative names can be added programmatically during runtime: Loader.java.
Windows library (dll) search paths:
- Current directory
- Application directory (java.exe)
- Windows System directories
- Windows PATH variable
System.setProperty("jna.debug_load", "true");
System.out.println(System.getProperty("java.library.path"));
System.out.println(System.getProperty("jna.library.path"));
java.library.path
jna.library.path
- Resource path: JAR or
build\classes\java\main
DLLs depend on other DLLs. In this case linking is done by the Windows OS and not by JNA.
To check dependencies, run ldd from WinGW Terminal: ldd library-to-check.dll
DLLs loaded by JNA must be identical (same file, not a copy) with DLLs loaded by Windows.
lib[name]-[major]-[minor].dll
GTK-4 library: libgtk-4-1.dll. Name used by java-gtk: "gtk-4" => JNA searches for: gtk-4.dll
Standard C Library as provided by Microsoft: msvcrt.dll