镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

GNU/Linux startup script compares jreMinVersion as text #505

Open

Description

@fvarrui

On GNU/Linux, without a bundled JRE, the startup script compares the installed Java version with jreMinVersion as text, so it can reject a newer Java or accept an older one.

Where

linux/startup.sh.vtl, compareVersions() (line 41): [[ "${v1[$i]}" > "${v2[$i]}" ]] is a string comparison in Bash. Examples:

  • Java 17.0.9 with jreMinVersion 8: "17" > "8" is false, so the app refuses to start with "The application requires a Java Runtime Environment 8 or higher".
  • Java 9 with jreMinVersion 11: "9" > "11" is true, so it starts.

Possible fix

Compare numerically: (( 10#${v1[$i]} > 10#${v2[$i]} )) (and the same for <), handling 1.8-style versions (major 1 means the second component).

Workaround

Bundle a JRE, or don't set jreMinVersion for GNU/Linux.

Activity

  1. fvarrui commented on Oct 11, 2026

    @fvarrui
    CollaboratorAuthor

    Fixed in devel (29e3392): the startup script compares the versions numerically (the leading digits of each part, and 1.x as x), so Java 17 passes jreMinVersion 8 and Java 9 fails 11. The CI renders the script with jreMinVersion and checks 8 version pairs on every push (./gradlew checkTemplates).

    It will ship in 2.0.1, and I'll close this issue then.

    How to test 2.0.1-SNAPSHOT

    Important

    Since 2.0.0 the groupId, the Gradle plugin id and the Java packages are io.github.javapackager (see Upgrading to 2.0).

    Maven, add the snapshots repository and use the snapshot version:

    <pluginRepositories>
        <pluginRepository>
            <id>central-portal-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
    </pluginRepositories>
    [...]
    <plugin>
        <groupId>io.github.javapackager</groupId>
        <artifactId>javapackager</artifactId>
        <version>2.0.1-SNAPSHOT</version>
        [...]
    </plugin>

    Gradle, add the snapshots repository in settings.gradle:

    pluginManagement {
        repositories {
            maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
            gradlePluginPortal()
        }
    }

    and use the snapshot version in build.gradle:

    plugins {
        id 'io.github.javapackager' version '2.0.1-SNAPSHOT'
    }

    See Snapshot versions for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedIssue fixed and release pending

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions