release 7.1 process - change validation for required java version, according to

https://groups.google.com/d/msg/idempiere/8Jc5pdWqKoo/oyeQqu0dCAAJ
This commit is contained in:
Carlos Ruiz 2019-11-25 09:58:38 +01:00
parent efc36003ce
commit 3975bacc99
1 changed files with 12 additions and 10 deletions

View File

@ -73,20 +73,22 @@ public class ConfigVM extends Config
System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath()); System.setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());
// Java Version // Java Version
final String[] versions = new String[]{"1.7.0", "1.8.0", "9", "9.", "10", "10.", "11", "11.", "12", "12."};
pass = false; pass = false;
String thisJV = System.getProperty("java.version"); String thisJV = System.getProperty("java.version");
for(String version : versions) int pointPos = thisJV.indexOf(".");
int thisJVint = 0;
if (pointPos >= 0)
thisJVint = Integer.valueOf(thisJV.substring(0, pointPos));
else
thisJVint = Integer.valueOf(thisJV);
int minSupportedVersion = 11;
pass = thisJVint >= minSupportedVersion;
if (pass)
{ {
pass = thisJV.indexOf(version) != -1; if (log.isLoggable(Level.INFO)) log.info("OK: Version=" + thisJV);
if (pass) }
{
if (log.isLoggable(Level.INFO)) log.info("OK: Version=" + thisJV);
break;
}
}
error = "Wrong Java Version: Should be " + versions[0] + " and above."; error = "Wrong Java Version = " + thisJV + ": Should be " + minSupportedVersion + " and above.";
if (getPanel() != null) if (getPanel() != null)
signalOK(getPanel().okJavaHome, "ErrorJavaHome", signalOK(getPanel().okJavaHome, "ErrorJavaHome",
pass, true, error); pass, true, error);