Skip to content

Always manage own Java versions #663

@brawaru

Description

@brawaru

Is your suggested enhancement related to a problem? Please describe.

The way Theseus currently manages its own Java versions is very inconsistent and very error prone. It only downloads its own JREs during the first launch, and only if it fails to discover already installed JREs, and will never download them again. This is hugely problematic as proven by several support requests in Discord:

  • Some users download Java 8 from Oracle website which installer often fails to properly detect whether the running system is 64-bit, therefore it downloads 32-bit version and then user comes asking why their Minecraft won't start with JVM error telling that it failed to allocate memory. Because 32-bit apps can only allocate memory within the first 4 GB of RAM due to how addressing works.

  • Theseus has a weird tendency to use existing Java 8 installation for Java 17, saw that on several screenshots user sent. I assumed there was a check for that but I guess not? This is obviously bad, because Minecraft >=1.17 requires Java 16 and >=1.18 Java 17 to launch.

  • Other users move their installation directory to other place, and then they find themselves in a situation where Theseus tells them they don't have the correct Java path. Tech illiterate users will have a hard time finding how to move the Java that Theseus previously downloaded.

  • There other weird situations in which the current way fails the user.

Moreover, separation of Java 17 and 8 is confusing and not future-proof (what happens when Minecraft updates to, say, Java 20, do you just add another field? Isn't that too many fields?).

Describe the solution you'd like

I propose that Theseus manages its own JREs at all times unless user specifically overrides Java required to launch a specific Minecraft version. It will also only download (or update) JREs on demand when the version is launched using the managed JRE, not just download them all a single time during the first launch of Theseus.

Almost every Minecraft version manifest includes a Java version required to launch it, these versions are codenamed by Mojang:

  • java-legacy (major 8), which is the current Java 8 LTS
  • java-runtime-alpha (major 16), which is the Java 16.0.1.9.1
  • java-runtime-beta (major 17), which is the Java 17.0.1.12.1
  • java-runtime-gamma (major 17), which is the current Java 17.0.8
  • java-runtime-gamma-snapshot (major 17), which is the Java 17.0.8
  • java-runtime-delta (major 21), which is the Java 21.0.2
  • minecraft-java-exe (major ??), which is a Windows-exclusive bouncer to JAVA_HOME
  • whereas absent, assumed java-legacy.

Theseus seems to be already use this information to determine which version to use, so with the new solution it can use it to determine which managed JRE to download or update.

It also shouldn't be downloading singular versions, despite how Mojang locks them. Java is meant to be updated, therefore Theseus should keep them up-to-date, regardless whether Mojang locks them on specific versions (I doubt anything would break by switching from 17.0.1 to 17.0.3). Updates often bring security improvements and given how bad security in Minecraft modding scene, this won't hurt.

To do so, and to keep it clean, you will also need to use specific codenaming, which can be as simple as forming a string {kind}-{major}-{platform}-{arch} (e.g., jre-17-windows-x86_64 (this will allow to update existing major version, but keep it separate by platform and architecture, in case user wants to share the launcher config directory between multiple operating systems).

Maybe even have Java on versions on meta.modrinth.com and Daedalus to fetch the up-to-date versions to the bucket so that they can be partially download and deduplicated instead of fetching the whole archives from Azul. That is, do it the way Mojang does, except don't lock the majors.

This way you can avoid having to force a Theseus update when a new Minecraft version comes up that uses a yet unseen JRE, you will just have to add it to manifest on your servers and voila, all latest Theseus versions (that can fetch and read the manifest) work like nothing ever happened, support channel crisis averted.

Plus if you do hash based asset separation, you can deduplicate files on your servers and reduce amounts clients will need to download when versions update (just check if hash of existing file matches one wanted by the server, and if so, skip downloading, continue to next file), this way you don't have to download same LICENSE file several times, even though it doesn't change between the versions.

Only if user explicitly opts out by overriding the Java version in instance options should Theseus skip the JRE management and use whichever JVM user asked to be used.

Describe alternatives you've considered

  • Implement more safeguards, that is check currently installed versions, and such. But this is just making things more complicated than they should be.
  • Re-install JREs if they're missing. This is almost what I propose, but worse.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    appRelates to Modrinth App

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions