Java版本混淆

huangapple go评论66阅读模式
英文:

Java versions confusion

问题

我想在几台不同的服务器上安装Java,以运行Tomcat上的第三方服务。
我不是Java开发人员,当我开始搜索安装程序时,感到有些困惑。

我检查了不同的Java版本以及它们的长期支持日期。
看起来Java 11 JDK是LTS版本,所以我决定使用它。
但当我尝试找到运行时版本(JRE?),因为这是我应该在服务器上安装的版本,我只找到了Java JRE 8.X.X,这让我感到困惑。

难道没有更高的JRE主要版本吗?
如果您作为开发人员使用JDK 11甚至14-15,然后在部署的服务器上使用Java 8 JRE,那该怎么办?

也许JDK内部包含Java 8 JRE版本?
或者实际上需要在服务器上安装JDK版本吗?

英文:

I want to install Java on a few different servers for running a third party service on tomcat.
I am not a Java developer and I got a bit confused when I began searching for the installer.

I checked the different Java versions and their long term support dates.
It seems that Java 11 JDK is - LTS so i decided to use it.
But when I was trying to find a runtime version (JRE?) since this is the version I am supposed to install on the server(?) I only found Java JRE 8.X.X, and this got me confused.

There is no higher major version of the JRE?
How does it work if you use the JDK 11 or even 14-15 as a developer and then use Java 8 JRE on your deployed servers?

Maybe the JDK holds inside of it the Java 8 JRE version?
Or do you actually need to install the JDK version on the servers instead?

答案1

得分: 1

JRE是JDK的子集。它包含了运行Java应用程序所需的一切,但不支持开发。因此,如果你需要一个JRE,JDK也是可以的,尽管它包含了许多你不需要的东西。

通常情况下,要执行Java应用程序,你需要一个与开发所使用的JDK版本相同或更高版本的JRE。但开发人员可以建议编译器生成较低版本的代码。如果这样做,他就不能使用较高版本的功能。例如,JDK 1.8的编译器可以为JRE 1.6生成代码。你应该查阅手册,了解特定版本的编译器支持哪些旧版本。

英文:

The JRE is a subset of JDK. It contains everything needet to run Java applications but no support for development. So, if you need a JRE, a JDK is also good, although it conatins much stuff that you will not need.

Normally, for executing a Java application, you need a JRE with the same version or higher than the JDK used for development. But the developer can advise the compiler to generate code for a lower version. If he does so, he cannot use the features of the higher versions. For example the compiler of JDK 1.8 can produce code for JRE 1.6. You should consult the manual, to see which old versions are supported by the compiler of a specific version.

答案2

得分: 0

经过一些研究,

似乎不再有单独的JRE部分。
此外,用于生产环境的JDK 11不再免费,我想这在不久的将来会持续成为一个趋势。

顺便提一下,虽然有open JDK 11版本,但它会警告您存在过时的安全更新。

因此,基本上在我这种情况下,继续使用更新的Java JRE 8版本对于不久的将来来说是足够的。

英文:

After some research,

It seems there is no separate JRE section anymore.
Also JDK 11 for production is not free and I guess this is an ongoing trend for the near future.

On a side note there is the open JDK 11 version but it does warn you about outdated security updates.

So basically in my case sticking to updated Java JRE 8 version is good enough for the near future.

huangapple
  • 本文由 发表于 2020年9月6日 19:31:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/63763656.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定