mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-11-20 17:11:57 +00:00
GH-1365 use the first part of the java version number as the major version - native extraction
This commit is contained in:
parent
07449e514a
commit
b437988d7b
@ -31,6 +31,9 @@ import java.util.Enumeration;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
@ -235,8 +238,11 @@ public class Utils
|
|||||||
ZipFile zip = new ZipFile(source);
|
ZipFile zip = new ZipFile(source);
|
||||||
|
|
||||||
boolean applyHacks = false;
|
boolean applyHacks = false;
|
||||||
String[] javaVersionElements = System.getProperty("java.version").split("\\.");
|
// find the first number in the version string, treat that as the major version
|
||||||
int major = Integer.parseInt(javaVersionElements[1]);
|
String s = System.getProperty("java.version");
|
||||||
|
Matcher matcher = Pattern.compile("\\d+").matcher(s);
|
||||||
|
matcher.find();
|
||||||
|
int major = Integer.valueOf(matcher.group());
|
||||||
if (major >= 8)
|
if (major >= 8)
|
||||||
{
|
{
|
||||||
applyHacks = true;
|
applyHacks = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user