SKCraft / Launcher

🚀 Distribute your Minecraft modpacks with a custom launcher
Other
625 stars 437 forks source link

Doesn't use user chosen java #471

Closed shinji257 closed 2 years ago

shinji257 commented 2 years ago

When choosing to add an undetected java it doesn't actually use it. Instead it uses an Oracle release (properly detected otherwise) instead.

shinji257 commented 2 years ago

Actually it doesn't use any of the options in the drop down. For me it is choosing Oracle 17.0.3 but if I choose Oracle 15 it is ignored.

shinji257 commented 2 years ago

I think I found where the issue might be coming from but can't yet figure out how to fix it (but I might be able to bandaid locally). It doesn't seem like dir is set properly from config in JavaRuntime.java. If I got it correctly it is populating information from @Data which is generated via lombok.Data but it seems to use a (seemingly) random java binary rather than the one I selected in the configuration screen.

https://github.com/SKCraft/Launcher/blob/master/launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaRuntime.java

hedgehog1029 commented 2 years ago

The Java runtime selected in launcher options is only used as a fallback if no better option can be found. Java 17 is required for minecraft 1.18, and since the launcher can find a valid Java 17 install it uses that instead. If the launcher always used the Java runtime selected in the options it would break either old versions (that require Java 8) or new versions (that require Java 16+).

However, you can still override a specific instance's Java settings by using the Instance Settings menu, accessible by right-clicking on the instance.

hedgehog1029 commented 2 years ago

Some actions to take off this issue though:

  1. Re-label the launcher options runtime as "fallback java"
  2. Allow adding of undetected instances in instance settings.
shinji257 commented 2 years ago

I've changed the behavior in our build to account for what is expected and implemented action 2 that you listed. I'm used to a setup where the launcher option is the global one then I set an instance one as needed as an override however thanks for the clarification on the expected behavior.