mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 15:26:27 -04:00
Fix FileNotFoundException *.hmc when launching.
This commit is contained in:
parent
bee81fd6d9
commit
0df7479e64
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ hs_err_pid*
|
|||||||
*.bat
|
*.bat
|
||||||
*.log
|
*.log
|
||||||
.mine*
|
.mine*
|
||||||
|
*.json
|
||||||
|
|
||||||
HMCLAPI/build/
|
HMCLAPI/build/
|
||||||
HMCL/build/
|
HMCL/build/
|
||||||
|
@ -90,7 +90,7 @@ task proguard(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
|
|||||||
|
|
||||||
configuration 'proguard.pro'
|
configuration 'proguard.pro'
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
task makeExecutable(dependsOn: jar) {
|
task makeExecutable(dependsOn: jar) {
|
||||||
ext {
|
ext {
|
||||||
def re = jar.classifier
|
def re = jar.classifier
|
||||||
@ -111,7 +111,7 @@ task makeExecutable(dependsOn: jar) {
|
|||||||
fos.write(bytes, 0, read);
|
fos.write(bytes, 0, read);
|
||||||
is.close()
|
is.close()
|
||||||
fos.close()
|
fos.close()
|
||||||
}
|
}*/
|
||||||
|
|
||||||
launch4j {
|
launch4j {
|
||||||
launch4jCmd = 'D:\\Develop\\Java\\Launch4j\\launch4j.exe'
|
launch4jCmd = 'D:\\Develop\\Java\\Launch4j\\launch4j.exe'
|
||||||
@ -135,5 +135,5 @@ processResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//build.dependsOn proguard
|
build.dependsOn proguard
|
||||||
build.dependsOn makeExecutable
|
//build.dependsOn makeExecutable
|
@ -36,6 +36,7 @@ import org.jackhuang.hellominecraft.utils.JdkVersion;
|
|||||||
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
|
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
|
||||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.utils.OS;
|
import org.jackhuang.hellominecraft.utils.OS;
|
||||||
|
import org.jackhuang.hellominecraft.utils.Platform;
|
||||||
import org.jackhuang.hellominecraft.utils.Utils;
|
import org.jackhuang.hellominecraft.utils.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +106,7 @@ public final class Launcher {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JdkVersion.isJava64Bit() && OS.is64Bit())
|
if (!JdkVersion.isJava64Bit() && OS.getPlatform() == Platform.BIT_32)
|
||||||
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
||||||
|
|
||||||
Method minecraftMain;
|
Method minecraftMain;
|
||||||
|
@ -26,11 +26,12 @@ import org.jackhuang.hellominecraft.HMCLog;
|
|||||||
import org.jackhuang.hellominecraft.launcher.Launcher;
|
import org.jackhuang.hellominecraft.launcher.Launcher;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider;
|
import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.settings.Profile;
|
import org.jackhuang.hellominecraft.launcher.utils.settings.Profile;
|
||||||
import org.jackhuang.hellominecraft.utils.FileUtils;
|
import org.jackhuang.hellominecraft.launcher.utils.settings.Settings;
|
||||||
import org.jackhuang.hellominecraft.utils.JdkVersion;
|
import org.jackhuang.hellominecraft.utils.JdkVersion;
|
||||||
import org.jackhuang.hellominecraft.utils.MathUtils;
|
import org.jackhuang.hellominecraft.utils.MathUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.utils.OS;
|
import org.jackhuang.hellominecraft.utils.OS;
|
||||||
|
import org.jackhuang.hellominecraft.utils.Platform;
|
||||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.Utils;
|
import org.jackhuang.hellominecraft.utils.Utils;
|
||||||
|
|
||||||
@ -62,24 +63,16 @@ public abstract class IMinecraftLoader {
|
|||||||
res.addAll(Arrays.asList(v.getWrapperLauncher().split(" ")));
|
res.addAll(Arrays.asList(v.getWrapperLauncher().split(" ")));
|
||||||
|
|
||||||
String str = v.getJavaDir();
|
String str = v.getJavaDir();
|
||||||
JdkVersion jv = null;
|
JdkVersion jv = new JdkVersion(str);
|
||||||
File f = new File(str + ".hmc");
|
if(Settings.getInstance().getJava().contains(jv))
|
||||||
try {
|
jv = Settings.getInstance().getJava().get(Settings.getInstance().getJava().indexOf(jv));
|
||||||
String s = FileUtils.readFileToString(f);
|
else try {
|
||||||
String[] strs = s.split("\n");
|
|
||||||
if (str.length() >= 2)
|
|
||||||
jv = new JdkVersion(strs[0], MathUtils.parseInt(strs[1], -1));
|
|
||||||
else
|
|
||||||
throw new IllegalStateException("The format of file: " + f + " is wrong: " + s);
|
|
||||||
} catch (IOException | IllegalStateException e) {
|
|
||||||
try {
|
|
||||||
jv = JdkVersion.getJavaVersionFromExecutable(str);
|
jv = JdkVersion.getJavaVersionFromExecutable(str);
|
||||||
jv.write(f);
|
Settings.getInstance().getJava().add(jv);
|
||||||
if (!f.exists())
|
Settings.save();
|
||||||
HMCLog.warn("Failed to load version from file " + f, e);
|
} catch (IOException ex) {
|
||||||
} catch (Exception ex) {
|
HMCLog.warn("Failed to get java version", ex);
|
||||||
HMCLog.warn("Failed to read JDKVersion.", ex);
|
jv = null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
res.add(str);
|
res.add(str);
|
||||||
|
|
||||||
@ -95,12 +88,12 @@ public abstract class IMinecraftLoader {
|
|||||||
res.add("-Xmn128m");
|
res.add("-Xmn128m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jv != null && jv.is64Bit == 0 && OS.is64Bit())
|
if (jv != null && jv.platform == Platform.BIT_32 && OS.getPlatform() == Platform.BIT_64)
|
||||||
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
MessageBox.Show(C.i18n("advice.os64butjdk32"));
|
||||||
|
|
||||||
if (!StrUtils.isBlank(v.getMaxMemory())) {
|
if (!StrUtils.isBlank(v.getMaxMemory())) {
|
||||||
int mem = MathUtils.parseMemory(v.getMaxMemory(), 2147483647);
|
int mem = MathUtils.parseMemory(v.getMaxMemory(), 2147483647);
|
||||||
if (jv != null && jv.is64Bit == 0 && mem > 1024)
|
if (jv != null && jv.platform == Platform.BIT_32 && mem > 1024)
|
||||||
MessageBox.Show(C.i18n("launch.too_big_memory_alloc_64bit"));
|
MessageBox.Show(C.i18n("launch.too_big_memory_alloc_64bit"));
|
||||||
else {
|
else {
|
||||||
long a = OS.getTotalPhysicalMemory() / 1024 / 1024;
|
long a = OS.getTotalPhysicalMemory() / 1024 / 1024;
|
||||||
@ -114,10 +107,10 @@ public abstract class IMinecraftLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!StrUtils.isBlank(v.getPermSize()) && !v.isNoJVMArgs())
|
if (!StrUtils.isBlank(v.getPermSize()) && !v.isNoJVMArgs())
|
||||||
if (jv != null && jv.ver != null && (jv.ver.startsWith("1.8") || jv.ver.startsWith("1.9"))); else res.add("-XX:MaxPermSize=" + v.getPermSize() + "m");
|
if (jv != null && jv.ver != null && (jv.ver.startsWith("1.8") || jv.ver.startsWith("1.9")));
|
||||||
|
else res.add("-XX:MaxPermSize=" + v.getPermSize() + "m");
|
||||||
|
|
||||||
if (!v.isNoJVMArgs())
|
if (!v.isNoJVMArgs()) appendJVMArgs(res);
|
||||||
appendJVMArgs(res);
|
|
||||||
|
|
||||||
HMCLog.log("On making java.library.path.");
|
HMCLog.log("On making java.library.path.");
|
||||||
|
|
||||||
|
@ -14,10 +14,11 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program.
|
* along with this program.
|
||||||
*/
|
*/
|
||||||
package org.jackhuang.hellominecraft.utils;
|
package org.jackhuang.hellominecraft.launcher.utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import org.jackhuang.hellominecraft.utils.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
@ -18,9 +18,12 @@ package org.jackhuang.hellominecraft.launcher.utils.settings;
|
|||||||
|
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.jackhuang.hellominecraft.utils.JdkVersion;
|
||||||
import org.jackhuang.hellominecraft.utils.OS;
|
import org.jackhuang.hellominecraft.utils.OS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,6 +45,12 @@ public final class Config {
|
|||||||
@SerializedName("theme")
|
@SerializedName("theme")
|
||||||
private int theme;
|
private int theme;
|
||||||
|
|
||||||
|
private List<JdkVersion> java;
|
||||||
|
|
||||||
|
public List<JdkVersion> getJava() {
|
||||||
|
return java == null ? java = new ArrayList<>() : java;
|
||||||
|
}
|
||||||
|
|
||||||
public int getTheme() {
|
public int getTheme() {
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hellominecraft.launcher.utils.settings;
|
package org.jackhuang.hellominecraft.launcher.utils.settings;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -25,10 +27,12 @@ import java.util.Objects;
|
|||||||
import org.jackhuang.hellominecraft.C;
|
import org.jackhuang.hellominecraft.C;
|
||||||
import org.jackhuang.hellominecraft.HMCLog;
|
import org.jackhuang.hellominecraft.HMCLog;
|
||||||
import org.jackhuang.hellominecraft.launcher.Main;
|
import org.jackhuang.hellominecraft.launcher.Main;
|
||||||
|
import org.jackhuang.hellominecraft.utils.EnumAdapter;
|
||||||
import org.jackhuang.hellominecraft.utils.tinystream.CollectionUtils;
|
import org.jackhuang.hellominecraft.utils.tinystream.CollectionUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.FileUtils;
|
import org.jackhuang.hellominecraft.utils.FileUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.IOUtils;
|
import org.jackhuang.hellominecraft.utils.IOUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.MessageBox;
|
import org.jackhuang.hellominecraft.utils.MessageBox;
|
||||||
|
import org.jackhuang.hellominecraft.utils.Platform;
|
||||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.UpdateChecker;
|
import org.jackhuang.hellominecraft.utils.UpdateChecker;
|
||||||
import org.jackhuang.hellominecraft.utils.VersionNumber;
|
import org.jackhuang.hellominecraft.utils.VersionNumber;
|
||||||
@ -38,7 +42,9 @@ import org.jackhuang.hellominecraft.utils.VersionNumber;
|
|||||||
* @author hyh
|
* @author hyh
|
||||||
*/
|
*/
|
||||||
public final class Settings {
|
public final class Settings {
|
||||||
|
|
||||||
public static final File settingsFile = new File(IOUtils.currentDir(), "hmcl.json");
|
public static final File settingsFile = new File(IOUtils.currentDir(), "hmcl.json");
|
||||||
|
public static final Gson gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Platform.class, new EnumAdapter<>(Platform.values())).create();
|
||||||
|
|
||||||
private static boolean isFirstLoad;
|
private static boolean isFirstLoad;
|
||||||
private static final Config settings;
|
private static final Config settings;
|
||||||
@ -64,13 +70,13 @@ public final class Settings {
|
|||||||
|
|
||||||
private static Config initSettings() {
|
private static Config initSettings() {
|
||||||
Config c = new Config();
|
Config c = new Config();
|
||||||
if (settingsFile.exists()) {
|
if (settingsFile.exists())
|
||||||
try {
|
try {
|
||||||
String str = FileUtils.readFileToString(settingsFile);
|
String str = FileUtils.readFileToString(settingsFile);
|
||||||
if (str == null || str.trim().equals("")) {
|
if (str == null || str.trim().equals(""))
|
||||||
HMCLog.log("Settings file is empty, use the default settings.");
|
HMCLog.log("Settings file is empty, use the default settings.");
|
||||||
} else {
|
else {
|
||||||
Config d = C.gsonPrettyPrinting.fromJson(str, Config.class);
|
Config d = gson.fromJson(str, Config.class);
|
||||||
if (d != null) c = d;
|
if (d != null) c = d;
|
||||||
}
|
}
|
||||||
HMCLog.log("Initialized settings.");
|
HMCLog.log("Initialized settings.");
|
||||||
@ -81,7 +87,7 @@ public final class Settings {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
HMCLog.log("No settings file here, may be first loading.");
|
HMCLog.log("No settings file here, may be first loading.");
|
||||||
isFirstLoad = true;
|
isFirstLoad = true;
|
||||||
}
|
}
|
||||||
@ -90,7 +96,7 @@ public final class Settings {
|
|||||||
|
|
||||||
public static void save() {
|
public static void save() {
|
||||||
try {
|
try {
|
||||||
FileUtils.write(settingsFile, C.gsonPrettyPrinting.toJson(settings));
|
FileUtils.write(settingsFile, gson.toJson(settings));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
HMCLog.err("Failed to save config", ex);
|
HMCLog.err("Failed to save config", ex);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.jackhuang.hellominecraft.launcher.launch.GameLauncher.DownloadLibrary
|
|||||||
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftLoader;
|
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftLoader;
|
||||||
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
|
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
|
||||||
import org.jackhuang.hellominecraft.launcher.launch.MinecraftLoader;
|
import org.jackhuang.hellominecraft.launcher.launch.MinecraftLoader;
|
||||||
import org.jackhuang.hellominecraft.utils.BaseLauncherProfile;
|
import org.jackhuang.hellominecraft.launcher.utils.BaseLauncherProfile;
|
||||||
import org.jackhuang.hellominecraft.utils.FileUtils;
|
import org.jackhuang.hellominecraft.utils.FileUtils;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.MCUtils;
|
import org.jackhuang.hellominecraft.launcher.utils.MCUtils;
|
||||||
import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider;
|
import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider;
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hellominecraft.utils;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.google.gson.JsonPrimitive;
|
||||||
|
import com.google.gson.JsonSerializationContext;
|
||||||
|
import com.google.gson.JsonSerializer;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huangyuhui
|
||||||
|
* @param <T> EnumType
|
||||||
|
*/
|
||||||
|
public class EnumAdapter<T extends Enum> implements JsonSerializer<T>, JsonDeserializer<T> {
|
||||||
|
T[] values;
|
||||||
|
|
||||||
|
public EnumAdapter(T[] values) {
|
||||||
|
this.values = values;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
|
return new JsonPrimitive(src.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
|
if(json.getAsInt() < values.length)
|
||||||
|
return values[json.getAsInt()];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -35,11 +35,32 @@ public final class JdkVersion {
|
|||||||
/**
|
/**
|
||||||
* -1 - unkown 0 - 32Bit 1 - 64Bit
|
* -1 - unkown 0 - 32Bit 1 - 64Bit
|
||||||
*/
|
*/
|
||||||
public int is64Bit;
|
public Platform platform;
|
||||||
|
|
||||||
public JdkVersion(String ver, int is64Bit) {
|
public String location;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(!(obj instanceof JdkVersion)) return false;
|
||||||
|
JdkVersion b = (JdkVersion)obj;
|
||||||
|
return new File(b.location).equals(new File(location));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new File(location).hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JdkVersion(String location) {
|
||||||
|
File f = new File(location);
|
||||||
|
if(f.exists() && f.isFile()) f = f.getParentFile();
|
||||||
|
this.location = f.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JdkVersion(String location, String ver, Platform platform) {
|
||||||
|
this(location);
|
||||||
this.ver = ver;
|
this.ver = ver;
|
||||||
this.is64Bit = is64Bit;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +167,7 @@ public final class JdkVersion {
|
|||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
int lineNumber = 0;
|
int lineNumber = 0;
|
||||||
String ver = null;
|
String ver = null;
|
||||||
int is64Bit = -1;
|
Platform platform = Platform.UNKNOWN;
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new InputStreamReader(is));
|
br = new BufferedReader(new InputStreamReader(is));
|
||||||
String line;
|
String line;
|
||||||
@ -162,11 +183,10 @@ public final class JdkVersion {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (line.contains("64-Bit")) {
|
if (line.contains("64-Bit"))
|
||||||
is64Bit = 1;
|
platform = Platform.BIT_64;
|
||||||
} else {
|
else
|
||||||
is64Bit = 0;
|
platform = Platform.BIT_32;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,12 +197,12 @@ public final class JdkVersion {
|
|||||||
br.close();
|
br.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new JdkVersion(ver, is64Bit);
|
return new JdkVersion(file, ver, platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(File f) throws IOException {
|
public void write(File f) throws IOException {
|
||||||
if (ver != null && is64Bit != -1) {
|
if (ver != null && platform != Platform.UNKNOWN) {
|
||||||
FileUtils.write(f, ver + "\n" + is64Bit);
|
FileUtils.write(f, ver + "\n" + platform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ public enum OS {
|
|||||||
return OS.UNKOWN;
|
return OS.UNKOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean is64Bit() {
|
public static Platform getPlatform() {
|
||||||
String arch = System.getProperty("os.arch");
|
String arch = System.getProperty("os.arch");
|
||||||
return arch.contains("64");
|
return arch.contains("64") ? Platform.BIT_64 : Platform.BIT_32;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hellominecraft.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huangyuhui
|
||||||
|
*/
|
||||||
|
public enum Platform {
|
||||||
|
UNKNOWN,
|
||||||
|
BIT_32,
|
||||||
|
BIT_64
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user