`
flashcloud
  • 浏览: 188830 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

How to switch JDK version on Mac OS X

 
阅读更多

出自:http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/

Apple decided to remove the Java Preferences application in a software update and afterwards in has been difficult to change the JDK version on Mac OS X. I especially noticed this after I installed the JDK 8 early access preview which makes some of the tips that you find on various blogs online useless. After a lot of googling I finally found a simple solution that I’d like to share.

 

What you do is to edit your ~/.bash_profile and add the following:

What the script does is to first remove other JDK versions in the PATH so that they won’t interfere with our new JDK version. Then it makes some clever use of /usr/libexec/java_home which is a command that lists installed JDK versions. The -v argument tells java_home to return the path of the JDK with the supplied version, for example 1.7. We also update the PATH to point to the bin directory of the newly found JAVA_HOME directory. At the end we can simply execute the function using

which selects the latest installed JDK version of the 1.7 branch. To select a specific version you can simply execute

 

instead. Run /usr/libexec/java_home -h to get more details on how to choose versions.

That’s it! All credits should go to Neeme Praks and his answer on superuser.com.

分享到:
评论

相关推荐

    jdk1.6for mac os x

    jdk1.6for mac os x 编译android 5.0以前版本必须

    JDK 18 for Mac OS ARM 64 version

    JDK 18 for Mac OS ARM 64 version

    Mac OS jdk1.8安装包

    提供的文件名为`jdk-8u131-macosx-x64.dmg`,这是Oracle公司为Mac OS X 64位系统发布的JDK 1.8的一个具体版本。通常,你可以从Oracle官方网站的Java SE下载页面获取最新版本的JDK,但在这里我们已经有了特定版本的...

    mac os jdk 最新版

    Mac OS JDK 最新版指的是适用于苹果操作系统Mac OS的Java Development Kit(JDK)的最新更新版本。JDK是Java编程语言的核心组件,包含了Java运行环境(JRE)、编译器、调试器以及各种工具,使开发者能够在Mac OS平台...

    jdk-8u45-macosx-x64(Mac OS X x64).dmg

    jdk-8u45 for Mac OS X x64 截至 2015-06-19 最新版 JDK for Mac OS X x64

    jdk-8u212-macosx-x64.dmg Mac OS X x64 安装包

    jdk-8u212-macosx-x64.dmg Mac OS X x64 安装包 截至2019.04.25 最新版JDK for Mac OS X x64 .dmg文件大小: 252.25 MB .dmg文件检验码 sha256: 9bcb4265a55e2fe63b9c58ca6c5a54eb6dda303bb69510ca6eddc2f088e41b2a ...

    bcmail-jdk15on-1.58,bcprov-jdk15on-1.58,bcpkix-jdk15on-1.58

    "bcpkix-jdk15on-1.58.jar"是Bouncy Castle的公钥基础设施(PKI)扩展包,它包含了X.509证书、证书路径验证、证书签名请求(CSR)创建等与证书相关的功能。这对于实现数字证书、电子签章、SSL/TLS服务器身份验证等...

    jdk-8u45-macosx-x64(Mac OS X x64).zip

    标题中的“jdk-8u45-macosx-x64(Mac OS X x64).zip”表明这是一个针对Mac OS X 64位操作系统的Java Development Kit (JDK) 的压缩包,版本号为8u45。JDK是开发和运行Java应用程序所需的核心组件,包括Java编译器、...

    bcprov-jdk15on-1.60-API文档-中英对照版.zip

    赠送jar包:bcprov-jdk15on-1.60.jar; 赠送原API文档:bcprov-jdk15on-1.60-javadoc.jar; 赠送源代码:bcprov-jdk15on-1.60-sources.jar; 赠送Maven依赖信息文件:bcprov-jdk15on-1.60.pom; 包含翻译后的API文档...

    bcprov-jdk15on jar包版本集合

    在实际应用中,bcprov-jdk15on可以用于创建和解析X.509证书,执行SSL/TLS协议,实现PGP(Pretty Good Privacy)加密和解密,以及在电子邮件、文件传输、数据库连接等场景下的数据加密。例如,如果你的项目需要自定义...

    bcprov-jdk15on-1.60.jar中文文档.zip

    bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,...

    bcprov-jdk15on-1.68-API文档-中文版.zip

    赠送jar包:bcprov-jdk15on-1.68.jar; 赠送原API文档:bcprov-jdk15on-1.68-javadoc.jar; 赠送源代码:bcprov-jdk15on-1.68-sources.jar; 赠送Maven依赖信息文件:bcprov-jdk15on-1.68.pom; 包含翻译后的API文档...

    bcprov-jdk15on-1.58.jar中文文档.zip

    bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,...

    bcprov-jdk15on-1.56.jar中文文档.zip

    bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,...

    bcprov-ext-jdk15on-152和bcprov-jdk15on-152

    标题中的"bcprov-ext-jdk15on-152"和"bcprov-jdk15on-152"是两个与Bouncy Castle库相关的Java档案文件,它们主要用于提供加密和安全服务。Bouncy Castle是一个开源的Java安全提供者,广泛用于密码学应用,包括加密、...

    bcprov-jdk15on-1.59-API文档-中文版.zip

    赠送jar包:bcprov-jdk15on-1.59.jar; 赠送原API文档:bcprov-jdk15on-1.59-javadoc.jar; 赠送源代码:bcprov-jdk15on-1.59-sources.jar; 赠送Maven依赖信息文件:bcprov-jdk15on-1.59.pom; 包含翻译后的API文档...

    bcprov-jdk15on-1.54.jar中文文档.zip

    bcprov-jdk15on-***.jar中文文档.zip,java,bcprov-jdk15on-***.jar,org.bouncycastle,bcprov-jdk15on,***,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,bouncycastle,bcprov,jdk15on,中文API文档,手册,...

    bcprov-jdk15on-1.60-API文档-中文版.zip

    赠送jar包:bcprov-jdk15on-1.60.jar; 赠送原API文档:bcprov-jdk15on-1.60-javadoc.jar; 赠送源代码:bcprov-jdk15on-1.60-sources.jar; 赠送Maven依赖信息文件:bcprov-jdk15on-1.60.pom; 包含翻译后的API文档...

    bcpkix-jdk15on-1.49.jar和bcprov-jdk15on-1.49.jar

    首先,我们来看bcpkix-jdk15on-1.49.jar,这个库主要关注PKIX(Public Key Infrastructure eXtensions)相关的功能,包括X.509证书处理、证书路径验证、证书签发、以及PKCS#10证书请求等。它扩展了Java的Java ...

    bcprov-jdk15on-1.59-API文档-中英对照版.zip

    赠送jar包:bcprov-jdk15on-1.59.jar; 赠送原API文档:bcprov-jdk15on-1.59-javadoc.jar; 赠送源代码:bcprov-jdk15on-1.59-sources.jar; 赠送Maven依赖信息文件:bcprov-jdk15on-1.59.pom; 包含翻译后的API文档...

Global site tag (gtag.js) - Google Analytics