libgdx is a Java library for lwjgl.

Generated app-image using JPackage does not respect Windows high-DPI settings

Good luck, this is super hard to debug. I had the following build.gradle:

tasks.jpackage {
	dependsOn("dist", "clearPackage")

    input  = "${buildDir}/libs"
    destination = "${buildDir}/package"
    mainJar = "desktop-0.1.jar" // TODO get version from main build.gradle
    mainClass = project.ext.mainClassName
    type = "app-image"  // remove to make an .exe that's an installer, there are other types...

    windows {
        winConsole = true // otherwise errors will just silently throw a "Failed to launch JVM" error

Which created the following file structure in build/package/DesktopLauncher:


Does running the .jar solve the DPI scaling problem? i.e. java -jar app/desktop-0.1.jar? If so, it’s likely a problem with JPackage (which I think is the ultimate problem).


I found this interesting solution:

  1. Install the Windows SDK
  2. Create a new manifest file that highlights your application is DPI-aware:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
      <dpiAware xmlns="">true</dpiAware>
      <dpiAwareness xmlns="">PerMonitorV2</dpiAwareness>
  1. Add this assembly to the generated .exe:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\mt.exe" -manifest DesktopLauncher.exe.manifest -outputresource:"DesktopLauncher.exe;#1"

Other solutions

This might be solved by using lwjgl 3.1.4+, not 2.x.