- # try using a windows version.
-#note: this logic is untested.
-# probably will break due to space in path issues.
- declare -a any_there=$(find "/c/Program Files/java" -type d -iname "jdk" 2>/dev/null)
- if [ ${#any_there[*]} -gt 0 ]; then
- (( last = ${#any_there[@]} - 1 ))
- JAVA_HOME="${any_there[$last]}"
- fi
- if [ ! -d "$JAVA_HOME" ]; then
- # if no jdk, try a jre.
- declare -a any_there=$(find "/c/Program Files/java" -type d -iname "jre" 2>/dev/null)
- if [ ${#any_there[*]} -gt 0 ]; then
- (( last = ${#any_there[@]} - 1 ))
- JAVA_HOME="${any_there[$last]}"
- fi
+ JAVA_HOME="$(ls -d c:/tools/*jdk* 2>/dev/null)"
+fi
+if [ ! -d "$JAVA_HOME" ]; then
+ if [ ! -z "$(grep -i 'd:' /proc/mounts 2>/dev/null)" ]; then
+ # try using a windows version.
+ JAVA_HOME="$(ls -d d:/tools/*jdk* 2>/dev/null)"