fix: [#465] don't start up the launcher when running on Java 16 or newer

This commit is contained in:
Ryan Dowling 2021-04-25 10:11:22 +10:00
parent 3377b99bcb
commit 844b261bae
No known key found for this signature in database
GPG key ID: 5539FCDB88950EFD
5 changed files with 27 additions and 2 deletions

View file

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16"]
java-version: ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15"]
steps:
- uses: actions/checkout@v2

3
.vscode/launch.json vendored
View file

@ -9,7 +9,8 @@
"projectName": "ATLauncher",
"cwd": "${workspaceFolder}/testLauncher",
"preLaunchTask": "makeTestLauncherDirectory",
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update"
"args": "--debug --debug-level 5 --disable-error-reporting --no-launcher-update",
},
{
"type": "java",

View file

@ -17,6 +17,7 @@ This changelog only contains the changes that are unreleased. For changes for in
- Checking mods on CurseForge sometimes failing
- Loading settings sometimes returning a NPE
- Forge maven changing url
- Don't start up the launcher when running on Java 16 or newer [#465]
### Misc
- Remove integration files from being written [#462]

View file

@ -102,6 +102,19 @@ public class Launcher {
OS.openWebBrowser("https://atl.pw/java8download");
System.exit(0);
}
if (Java.isJava16OrAbove()) {
LogManager.warn("You're using Java 16 or above which isn't supported by ATLauncher!");
DialogManager.optionDialog().setTitle(GetText.tr("Unsupported Java Version"))
.setContent(new HTMLBuilder().center().text(GetText.tr(
"You're using Java 16 or above which isn't supported by ATLauncher. You need to downgrade your Java in order to use ATLauncher.<br/><br/>The launcher will not start until you do this.<br/><br/>If you're seeing this message even after installing an older version, you may need to uninstall the newer version first.<br/><br/>Click ok to open the Java download page and close the launcher."))
.build())
.addOption(GetText.tr("Ok")).setType(DialogManager.ERROR).show();
OS.openWebBrowser("https://atl.pw/java8download");
System.exit(0);
}
}
public void loadEverything() {

View file

@ -151,6 +151,16 @@ public class Java {
getLauncherJavaVersion(), getMinecraftJavaVersionNumber(), getMinecraftJavaVersion());
}
/**
* Checks if the user is using Java 16 or above.
*
* @return true if the user is using Java 16 or above else false
*/
public static boolean isJava16OrAbove() {
int version = getLauncherJavaVersionNumber();
return version >= 16;
}
/**
* Checks if the user is using Java 7 or above.
*