With the Oracle FMW 12c version release, one of the normal requirement is to switch between multiple jdk versions for 12c & 11g build environments in mac. Below is a simple script which can help you to do that:
function switchjdk() {
if [ -z $1 ]; then
echo "please provide with the right jdk version to switch"
else
echo "switching to jdk version --- $1"
export PATH=$(echo $PATH | sed -E -e "s;:$JAVA_HOME/bin?;;" -e "s;$JAVA_HOME/bin:?;;")
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
export PATH=$JAVA_HOME/bin:$PATH
echo $(java -version)
fi
}
switchjdk $1

No comments:
Post a Comment