Mac computer JDK version switch

Source: Internet
Author: User

Apple has removed Java's preference management from its latest upgrade, so it is now difficult to manage the JDK version on Mac systems. I recently noticed that after loading the jdk8 want to change back, online tips are not good to use AH. After a lot of Google, I found a simple way to share.

function Setjdk () {  if [$#-ne 0]; then   removefrompath '/system/library/frameworks/javavm.framework/home/bin '   if [-N "${java_home+x}"]; then    removefrompath $JAVA _home   fi   export java_home= '/usr/libexec/java_ home-v [email protected] '   export path= $JAVA _home/bin: $PATH  fi} function Removefrompath () {  Export path=$ ( echo $PATH | SED-E-E "s;:$1;;"-E "s;$1:?;;") }SETJDK 1.7

Please put the above code into the bash_profile file after saving remember to play the command ~/.bash_profile.



The above is the result of the author's pro-test, if there is a problem please leave a message ~


Original address



Mac computer JDK version switch

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.