fix ExceptionInInitializerError
This commit is contained in:
@@ -450,7 +450,7 @@ public final class LauncherHelper {
|
|||||||
|
|
||||||
// First find if same java version but whose platform is 64-bit installed.
|
// First find if same java version but whose platform is 64-bit installed.
|
||||||
Optional<JavaVersion> java64 = JavaVersion.getJavas().stream()
|
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())
|
.filter(javaVersion -> javaVersion.getParsedVersion() == java32.getParsedVersion())
|
||||||
.max(Comparator.comparing(JavaVersion::getVersionNumber));
|
.max(Comparator.comparing(JavaVersion::getVersionNumber));
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ public final class LauncherHelper {
|
|||||||
|
|
||||||
// Then find if other java version which satisfies requirements installed.
|
// Then find if other java version which satisfies requirements installed.
|
||||||
java64 = JavaVersion.getJavas().stream()
|
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 -> {
|
.filter(javaVersion -> {
|
||||||
if (java8requiredFinal) return javaVersion.getParsedVersion() == JavaVersion.JAVA_8;
|
if (java8requiredFinal) return javaVersion.getParsedVersion() == JavaVersion.JAVA_8;
|
||||||
if (newJavaRequiredFinal) 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)
|
if (checkJava)
|
||||||
return JavaVersion.fromExecutable(Paths.get(getJavaDir()));
|
return JavaVersion.fromExecutable(Paths.get(getJavaDir()));
|
||||||
else
|
else
|
||||||
return new JavaVersion(Paths.get(getJavaDir()), "", Platform.PLATFORM);
|
return new JavaVersion(Paths.get(getJavaDir()), "", Platform.getPlatform());
|
||||||
} catch (IOException | InvalidPathException e) {
|
} catch (IOException | InvalidPathException e) {
|
||||||
return null; // Custom Java Directory not found,
|
return null; // Custom Java Directory not found,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ public final class SelfDependencyPatcher {
|
|||||||
static class DependencyDescriptor {
|
static class DependencyDescriptor {
|
||||||
|
|
||||||
private static final Path DEPENDENCIES_DIR_PATH = HMCL_DIRECTORY.resolve("dependencies");
|
private static final Path DEPENDENCIES_DIR_PATH = HMCL_DIRECTORY.resolve("dependencies");
|
||||||
|
|
||||||
public static final String CURRENT_ARCH_CLASSIFIER = currentArchClassifier();
|
public static final String CURRENT_ARCH_CLASSIFIER = currentArchClassifier();
|
||||||
|
|
||||||
private static String currentArchClassifier() {
|
private static String currentArchClassifier() {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class Library implements Comparable<Library>, Validation {
|
|||||||
public String getClassifier() {
|
public String getClassifier() {
|
||||||
if (artifact.getClassifier() == null)
|
if (artifact.getClassifier() == null)
|
||||||
if (natives != null && natives.containsKey(OperatingSystem.CURRENT_OS))
|
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
|
else
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public final class JavaVersion {
|
|||||||
CURRENT_JAVA = new JavaVersion(
|
CURRENT_JAVA = new JavaVersion(
|
||||||
currentExecutable,
|
currentExecutable,
|
||||||
System.getProperty("java.version"),
|
System.getProperty("java.version"),
|
||||||
Platform.PLATFORM);
|
Platform.getPlatform());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<JavaVersion> JAVAS;
|
private static Collection<JavaVersion> JAVAS;
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ public enum Platform {
|
|||||||
/**
|
/**
|
||||||
* The platform of current Java Environment.
|
* 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}.
|
* The json serializer to {@link Platform}.
|
||||||
|
|||||||
Reference in New Issue
Block a user