From dad7cd8da59d33146270c8ac992655216f2ebf9a Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 18 May 2015 11:44:07 +0000
Subject: [PATCH] SSDM-1805 Print nicer error message when trying to run
 openBIS installer with java 1.6 or earlier

SVN: 33987
---
 installation/resource/tarball/run-console.sh | 20 ++++++++++++++++++++
 installation/resource/tarball/run-ui.sh      | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/installation/resource/tarball/run-console.sh b/installation/resource/tarball/run-console.sh
index 13665502284..85acdb4ed75 100755
--- a/installation/resource/tarball/run-console.sh
+++ b/installation/resource/tarball/run-console.sh
@@ -1,5 +1,25 @@
 #!/bin/bash
 
+#Detect Java version
+
+if type -p java; then
+    _java=java
+else
+    echo "Java not available"
+fi
+
+if [[ "$_java" ]]; then
+    version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+    if [[ "$version" > "1.6" ]]; then
+        echo Java version $version found.
+    else         
+        echo Java version $version found is under the required 1.7.
+		exit -1
+    fi
+fi
+
+#Continue installation
+
 #	
 # reads the 'admin' user password from the console
 #
diff --git a/installation/resource/tarball/run-ui.sh b/installation/resource/tarball/run-ui.sh
index 05c96a711a1..90a0ab1a4fb 100755
--- a/installation/resource/tarball/run-ui.sh
+++ b/installation/resource/tarball/run-ui.sh
@@ -1,5 +1,25 @@
 #!/bin/bash
 
+#Detect Java version
+
+if type -p java; then
+    _java=java
+else
+    echo "Java not available"
+fi
+
+if [[ "$_java" ]]; then
+    version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+    if [[ "$version" > "1.6" ]]; then
+        echo Java version $version found.
+    else         
+        echo Java version $version found is under the required 1.7.
+		exit -1
+    fi
+fi
+
+#Continue installation
+
 BASE=`dirname "$0"`
 if [ ${BASE#/} == ${BASE} ]; then
     BASE="`pwd`/${BASE}"
-- 
GitLab