mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 23:37:14 -04:00
fix ExceptionInInitializerError
This commit is contained in:
parent
5310de88d5
commit
d77a09042d
@ -450,7 +450,7 @@ public final class LauncherHelper {
|
||||
|
||||
// First find if same java version but whose platform is 64-bit installed.
|
||||
Optional<JavaVersion> java64 = JavaVersion.getJavas().stream()
|
||||
.filter(javaVersion -> javaVersion.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.PLATFORM)
|
||||
.filter(javaVersion -> javaVersion.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.getPlatform())
|
||||
.filter(javaVersion -> javaVersion.getParsedVersion() == java32.getParsedVersion())
|
||||
.max(Comparator.comparing(JavaVersion::getVersionNumber));
|
||||
|
||||
@ -459,7 +459,7 @@ public final class LauncherHelper {
|
||||
|
||||
// Then find if other java version which satisfies requirements installed.
|
||||
java64 = JavaVersion.getJavas().stream()
|
||||
.filter(javaVersion -> javaVersion.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.PLATFORM)
|
||||
.filter(javaVersion -> javaVersion.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.getPlatform())
|
||||
.filter(javaVersion -> {
|
||||
if (java8requiredFinal) return javaVersion.getParsedVersion() == JavaVersion.JAVA_8;
|
||||
if (newJavaRequiredFinal) return javaVersion.getParsedVersion() >= JavaVersion.JAVA_8;
|
||||
|
@ -567,7 +567,7 @@ public final class VersionSetting implements Cloneable {
|
||||
if (checkJava)
|
||||
return JavaVersion.fromExecutable(Paths.get(getJavaDir()));
|
||||
else
|
||||
return new JavaVersion(Paths.get(getJavaDir()), "", Platform.PLATFORM);
|
||||
return new JavaVersion(Paths.get(getJavaDir()), "", Platform.getPlatform());
|
||||
} catch (IOException | InvalidPathException e) {
|
||||
return null; // Custom Java Directory not found,
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ public final class SelfDependencyPatcher {
|
||||
static class DependencyDescriptor {
|
||||
|
||||
private static final Path DEPENDENCIES_DIR_PATH = HMCL_DIRECTORY.resolve("dependencies");
|
||||
|
||||
public static final String CURRENT_ARCH_CLASSIFIER = currentArchClassifier();
|
||||
|
||||
private static String currentArchClassifier() {
|
||||
|
@ -94,7 +94,7 @@ public class Library implements Comparable<Library>, Validation {
|
||||
public String getClassifier() {
|
||||
if (artifact.getClassifier() == null)
|
||||
if (natives != null && natives.containsKey(OperatingSystem.CURRENT_OS))
|
||||
return natives.get(OperatingSystem.CURRENT_OS).replace("${arch}", Platform.PLATFORM.getBit());
|
||||
return natives.get(OperatingSystem.CURRENT_OS).replace("${arch}", Platform.getPlatform().getBit());
|
||||
else
|
||||
return null;
|
||||
else
|
||||
|
@ -165,7 +165,7 @@ public final class JavaVersion {
|
||||
CURRENT_JAVA = new JavaVersion(
|
||||
currentExecutable,
|
||||
System.getProperty("java.version"),
|
||||
Platform.PLATFORM);
|
||||
Platform.getPlatform());
|
||||
}
|
||||
|
||||
private static Collection<JavaVersion> JAVAS;
|
||||
|
@ -47,7 +47,9 @@ public enum Platform {
|
||||
/**
|
||||
* The platform of current Java Environment.
|
||||
*/
|
||||
public static final Platform PLATFORM = Architecture.CURRENT.getPlatform();
|
||||
public static Platform getPlatform() {
|
||||
return Architecture.CURRENT.getPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* The json serializer to {@link Platform}.
|
||||
|
Loading…
x
Reference in New Issue
Block a user