Skip to content

Commit

Permalink
jdk 11 ea too
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-hammant committed Mar 22, 2018
1 parent da30aba commit 96592b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions add_switchjdk_to_bash_profile_safely.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ NL='

bashProfile=$(cat ~/.bash_profile | sed '/switchjdk-module/d')
echo "${bashProfile}${NL}${NL}# Leave this switchjdk-module.bash incantation as a single line, so that homebrew upgrades are smooth${NL}if [ -f $(brew --prefix)/etc/switchjdk-module.bash ]; then source $(brew --prefix)/etc/switchjdk-module.bash; fi${NL}" > ~/.bash_profile

echo "*** Did the above fail with permissions errors? ***"
echo "If yes, you will need to do this after homebrew finishes (once off):"
echo " /usr/local/Cellar/switchjdk/$1/bin/add_switchjdk_to_bash_profile_safely.sh"
4 changes: 2 additions & 2 deletions switchjdk-module.bash
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ function switchjdk {
eval "export PATH=${jdk}Home/bin:$path"

# Check Java version. 5-8 and zulu varients, first
javaVersion="$(java -version 2>&1 | grep -E '^java|openjdk version*' | sed 's/\"1\.//' | sed 's/java//' | sed 's/openjdk//' | sed 's/version//' | sed 's/\"//g' | xargs | cut -d' ' -f1 | cut -d'.' -f1)"
javaVersion="$(java -version 2>&1 | grep -E '^java|openjdk version*' | sed 's/\"1\.//' | sed 's/\-ea//' | sed 's/java//' | sed 's/openjdk//' | sed 's/version//' | sed 's/\"//g' | xargs | cut -d' ' -f1 | cut -d'.' -f1)"

if [ "$javaVersion" != "$ver" ] ; then
echo "Requested JDK is not really installed. Was seemingly OK, up until getting 'java -version' to report the version installed."
return 1
fi

# Check Javac version
javacVersion="$(javac -version 2>&1 | grep '^javac *' | sed 's/ 1\./ /' | cut -d' ' -f2 | cut -d'.' -f1)"
javacVersion="$(javac -version 2>&1 | grep '^javac *' | sed 's/ 1\./ /' | sed 's/\-ea//' | cut -d' ' -f2 | cut -d'.' -f1)"
if [ "$javacVersion" != "$ver" ] ; then
echo "Requested JDK is not really installed. Was seemingly OK, up until getting 'javac -version' to report the version installed."
return 1
Expand Down

0 comments on commit 96592b9

Please sign in to comment.