diff scripts/setjava.sh @ 207:7a17678c9a73

add script to help set java version
author smith@nwoca.org
date Tue, 01 Sep 2015 21:25:16 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/setjava.sh	Tue Sep 01 21:25:16 2015 +0100
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ "${1}" == "7" ]
+then
+  export JAVA_HOME=$JAVA7
+else
+  export JAVA_HOME=$JAVA8
+fi
+
+IFS=':'
+CYGWIN=nodosfilewarning
+PATHNEW=''
+for A in ${PATH}
+do
+
+  if [[ "$A" != *"Java"* || "$A" != *"jdk"* || "$A" == *"java"* ]] 
+  then
+    PATHNEW=$PATHNEW:"$A"
+  fi
+ 
+done
+export PATH=$JAVA_HOME/bin$PATHNEW
+
+# Output
+echo -e "JAVA_HOME\t" $JAVA_HOME
+echo -e "PATH"
+for A in ${PATH}
+do
+  echo "${A}"
+done
+