我应该如何升级我的 Java 编译器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20137984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 23:25:52  来源:igfitidea点击:

How should I upgrade my Java compiler

javamacoscompiler-construction

提问by Eric Baldwin

When I run $ javac Simulator.javathen I get the following warning:

当我运行时,$ javac Simulator.java我收到以下警告:

warning: ./particle_simulator/Atom.class: major version 51 is newer than 50, the highest major version supported by this compiler.

warning: ./particle_simulator/Atom.class: major version 51 is newer than 50, the highest major version supported by this compiler.

I don't know why I suddenly get this warning as I haven't made substantial changes to my code. Nevertheless, how do I upgrade my Java compiler?

我不知道为什么我突然收到此警告,因为我没有对我的代码进行实质性更改。然而,我该如何升级我的 Java 编译器?

I'm running Mac OSX 10.7.5 and my Java version is below:

我正在运行 Mac OSX 10.7.5,我的 Java 版本如下:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

采纳答案by Asaph

Download the JDK from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/. Make sure you get the OSX version. It has its own installer so installation should be pretty straight forward.

从 Oracle 下载 JDK:http: //www.oracle.com/technetwork/java/javase/downloads/。确保您获得 OSX 版本。它有自己的安装程序,因此安装应该非常简单。