简体   繁体   English

在Mac OSX上从JDK 8到JDK 7

[英]JDK 8 to JDK 7 on mac OSX

I was earlier using jdk 8 but now for a project I require jdk 7. I have a mac so how do I change my jdk from 8 to 7. I can see all the jdk installed on my mac from library-->java-->java virtual machines. 我以前使用的是jdk 8,但现在对于一个项目,我需要使用jdk7。我有一个Mac,因此如何将我的jdk从8更改为7。我可以从库-> java--看到Mac上安装的所有jdk。 > java虚拟机。 Also I have tried going to system preferences-->java control pannel-->java . 我也尝试去系统偏好-> Java控制面板-> Java。 This only shows the JRE does not show JDK's installed on mac so I cannot change that from here. 这仅显示JRE不显示在Mac上安装的JDK,因此无法从此处更改它。

Thanks 谢谢

Rather than downgrading the JDK, you are free to compile Java 7 compatible classes for this one project using your existing Java 8 JDK. 您可以使用现有的Java 8 JDK来为该项目编译Java 7兼容类,而不必降级JDK。

javac -source "7" -target "7" <other compile arguments here>

if you use an automated build tool such as ANT or Maven or an IDE you can simply configure these properties once (you'll have to check the documentation how to do that for your specific development tools). 如果您使用ANT或Maven等自动构建工具或IDE,则只需配置这些属性一次(您必须查看文档针对特定开发工具的操作方法)。

The javac documentation has more information on the usage of these flags: javac文档提供了有关这些标志用法的更多信息:

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html

You can use Gimby's solution 您可以使用Gimby的解决方案

or 要么

if you want / need the JDK 7 of java here is the download page : 如果您想要/需要Java的JDK 7,请访问以下下载页面:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

read this in order to choose your version of Java : 阅读此内容以选择您的Java版本:

What is the difference between a Java CPU (7u79) and PSU (7u80) release? Java CPU(7u79)和PSU(7u80)版本之间有什么区别?

Java SE Critical Patch Updates (CPU) contain fixes to security vulnerabilities and critical bug fixes. Java SE关键补丁更新(CPU)包含针对安全漏洞的修复程序和严重的错误修复程序。 Oracle strongly recommends that all Java SE users upgrade to the latest CPU releases as they are made available. Oracle强烈建议所有Java SE用户升级到可用的最新CPU版本。 Most user should choose this release. 大多数用户应选择此版本。 Java SE Patch Set Updates (PSU) contain all of the security fixes in the CPUs released up to that version, as well as additional non-critical fixes. Java SE补丁集更新(PSU)包含该版本之前发布的CPU中的所有安全补丁程序,以及其他非关键补丁程序。 Java PSU releases should only be used if you are being impacted by one of the additional bugs fixed in that version. 仅当您受到该版本中已修复的其他错误之一的影响时,才应使用Java PSU版本。

Then select the download link for mac. 然后选择mac的下载链接。

Hope this help 希望有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM