Why did the quality of the GUI deteriorate by half after creating the exe file with jpackage?

77 Views Asked by At

I'm using jpackage to convert the jar file to an exe, with the exe file provided by the internal JRE. As a result of the conversion, good results were obtained, the JRE weighs about 38.5 mb.

When I run the exe, the GUI quality is twice as WORSE as in a normal jar! In addition, the window of the new exe file increases on its own. Thus, very strange changes appear, as if the exe file is trying to imitate a window jar file. I want to point out that I am using libGdx for the GUI.

Comparison

desktop gradle:

{
plugins { id 'org.beryx.runtime' version '1.8.4' }
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = ["src/"]
sourceSets.main.resources.srcDirs = ["../android/assets"]

mainClassName = "com.iapp.chess.desktop.DesktopLauncher"
def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT)
project.ext.assetsDir = new File("../android/assets")

task runGame(dependsOn: classes, type: JavaExec) {
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.assetsDir
    ignoreExitValue = true
}

task debug(dependsOn: classes, type: JavaExec) {
    main = project.mainClassName
    classpath = sourceSets.main.runtimeClasspath
    standardInput = System.in
    workingDir = project.assetsDir
    ignoreExitValue = true
    debug = true
}

task dist(type: Jar) {
    manifest {
        attributes 'Main-Class': project.mainClassName
    }
    dependsOn configurations.runtimeClasspath
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
    with jar
    destinationDirectory = file("$buildDir/lib")
}
jpackageImage.dependsOn dist


dist.dependsOn classes

eclipse.project.name = appName + "-desktop"

runtime {
    options = ['--strip-debug',
               '--compress', '2',
               '--no-header-files',
               '--no-man-pages',
               '--strip-native-commands',
               '--vm', 'server']
    modules = ['java.base',
               'java.desktop',
               'jdk.unsupported']
    distDir = file(buildDir)

    jpackage {
        jpackageHome = 'C:\\Program Files\\Java\\jdk-17.0.2'
        mainJar = dist.archiveFileName.get()
        if (osName.contains('windows')) {
            imageOptions = ["--icon", file("../icons/icon.ico")]
        } else if (osName.contains('linux')) {
            imageOptions = ["--icon", file("../icons/icon.png")]
        } else if (osName.contains('mac')) {
            imageOptions = ["--icon", file("../icons/icon.icns")]
        }
    }
}

}

0

There are 0 best solutions below