Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for java version "9-ea"

Michael Peter Christen0d28f563f4f1
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index 44803ec6e..62619a9e9 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -153,9 +153,10 @@ public final class yacy {
final String javaVersion = System.getProperty("java.version");
if (javaVersion != null) { // unknown property !?
int pos = javaVersion.indexOf('.');
+ if (pos < 0) pos = javaVersion.indexOf('-'); // i.e. "9-ea"
int count = 1;
- for (; pos < javaVersion.length() && count < 2; pos++) {
- if (javaVersion.charAt(pos + 1) == '.') count++;
+ for (; pos >= 0 && pos < javaVersion.length() && count < 2; pos++) {
+ if (javaVersion.charAt(pos + 1) == '.' || javaVersion.charAt(pos + 1) == '-') count++;
}
Double dVersion = Double.parseDouble(javaVersion.substring(0, pos));
if (dVersion < 1.7) { // required min java 1.7