mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-01-30 14:39:56 +08:00
Download Java on MacOS aarch64
This commit is contained in:
parent
3af115ce37
commit
74a305c32a
@ -77,7 +77,7 @@ public class JavaDownloadTask extends Task<Void> {
|
||||
|
||||
@Override
|
||||
public void preExecute() throws Exception {
|
||||
this.platform = JavaRepository.getCurrentJavaPlatform().orElseThrow(UnsupportedPlatformException::new);
|
||||
this.platform = JavaRepository.getSystemJavaPlatform().orElseThrow(UnsupportedPlatformException::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public final class JavaRepository {
|
||||
public static Task<?> downloadJava(GameJavaVersion javaVersion, DownloadProvider downloadProvider) {
|
||||
return new JavaDownloadTask(javaVersion, getJavaStoragePath(), downloadProvider)
|
||||
.thenRunAsync(() -> {
|
||||
Optional<String> platform = getCurrentJavaPlatform();
|
||||
Optional<String> platform = getSystemJavaPlatform();
|
||||
if (platform.isPresent()) {
|
||||
addJava(getJavaHome(javaVersion, platform.get()));
|
||||
}
|
||||
@ -41,7 +41,7 @@ public final class JavaRepository {
|
||||
}
|
||||
|
||||
public static void initialize() throws IOException, InterruptedException {
|
||||
Optional<String> platformOptional = getCurrentJavaPlatform();
|
||||
Optional<String> platformOptional = getSystemJavaPlatform();
|
||||
if (platformOptional.isPresent()) {
|
||||
String platform = platformOptional.get();
|
||||
Path javaStoragePath = getJavaStoragePath();
|
||||
@ -60,7 +60,7 @@ public final class JavaRepository {
|
||||
}
|
||||
}
|
||||
|
||||
public static Optional<String> getCurrentJavaPlatform() {
|
||||
public static Optional<String> getSystemJavaPlatform() {
|
||||
if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
|
||||
if (Architecture.SYSTEM_ARCH == Architecture.X86) {
|
||||
return Optional.of("linux-i386");
|
||||
@ -68,7 +68,7 @@ public final class JavaRepository {
|
||||
return Optional.of("linux");
|
||||
}
|
||||
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
|
||||
if (Architecture.SYSTEM_ARCH == Architecture.X86_64) {
|
||||
if (Architecture.SYSTEM_ARCH == Architecture.X86_64 || Architecture.SYSTEM_ARCH == Architecture.ARM64) {
|
||||
return Optional.of("mac-os");
|
||||
}
|
||||
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
|
||||
|
Loading…
Reference in New Issue
Block a user