diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-12-28 19:06:03 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-12-28 19:06:03 +0100 |
commit | b437988d7b06c1e43928f6e285469cb6451c2c85 (patch) | |
tree | 94edf9cde040d344b2932c2e53674c9d0214dada /depends | |
parent | 07449e514af441f964a57b764de7fae67c9d5135 (diff) | |
download | MultiMC-b437988d7b06c1e43928f6e285469cb6451c2c85.tar MultiMC-b437988d7b06c1e43928f6e285469cb6451c2c85.tar.gz MultiMC-b437988d7b06c1e43928f6e285469cb6451c2c85.tar.lz MultiMC-b437988d7b06c1e43928f6e285469cb6451c2c85.tar.xz MultiMC-b437988d7b06c1e43928f6e285469cb6451c2c85.zip |
GH-1365 use the first part of the java version number as the major version - native extraction
Diffstat (limited to 'depends')
-rw-r--r-- | depends/launcher/org/multimc/Utils.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/depends/launcher/org/multimc/Utils.java b/depends/launcher/org/multimc/Utils.java index 1077065a..67a4b8e8 100644 --- a/depends/launcher/org/multimc/Utils.java +++ b/depends/launcher/org/multimc/Utils.java @@ -31,6 +31,9 @@ import java.util.Enumeration; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class Utils { @@ -235,8 +238,11 @@ public class Utils ZipFile zip = new ZipFile(source); boolean applyHacks = false; - String[] javaVersionElements = System.getProperty("java.version").split("\\."); - int major = Integer.parseInt(javaVersionElements[1]); + // find the first number in the version string, treat that as the major version + String s = System.getProperty("java.version"); + Matcher matcher = Pattern.compile("\\d+").matcher(s); + matcher.find(); + int major = Integer.valueOf(matcher.group()); if (major >= 8) { applyHacks = true; |