简体   繁体   English

Glassfish 4.1上可以使用Java 8吗?

[英]Will it be possible to use Java 8 on Glassfish 4.1?

我们当前使用的是Glassfish 4.1,我真的很想使用Java8。Glassfish4.1是否可以与Java 8一起使用,还是必须升级我的应用程序容器?

Simple answer, 简单的答案,

Yes. 是。

GlassFish 4.1 will work with Java 1.8. GlassFish 4.1将与Java 1.8一起使用。

In general: updating the jvm version alone rarely leads to issues. 通常,仅更新jvm版本很少导致问题。

Keep in mind that a lot of work goes into making sure that new Java versions are backwards compatible. 请记住,要确保新的Java版本向后兼容,需要进行大量工作。 And most importantly: a new jvm can always run byte code compiled for an older version of Java. 最重要的是:新的jvm始终可以运行为较旧版本的Java编译的字节码。 The other way round (upgrading your application server for example) is much more likely to cause significant problems. 反之(例如升级应用程序服务器)更有可能导致重大问题。

So, the (unspecific) answer here is: just try it. 因此,这里的(不确定的)答案是:尝试一下。 And for the record: Java 9 (or newer) with the new module system is a completely different story. 并记录在案:具有新模块系统的Java 9(或更高版本)完全不同。 But at least for now, the corresponding checking can be disabled on the command line. 但是至少到目前为止,可以在命令行上禁用相应的检查。

Of course, there can be subtle issues for large applications. 当然,对于大型应用程序可能会存在一些细微问题。 A new jvm may use different defaults for say, garbage collection settings (or use a different gc in the first place). 一个新的jvm可能对垃圾收集设置使用不同的默认值(或者首先使用不同的gc)。 That can of course change the runtime characteristics of large applications running in a large stack. 当然,这可以更改在大型堆栈中运行的大型应用程序的运行时特性。

The best (and easiest) approach for determining whether Java version 'x' will work Glassfish version 'y' is to refer to the Release Note for that specific Glassfish release. 确定Java版本“ x”是否适用于Glassfish版本“ y”的最佳(最简单)方法是,参考该特定Glassfish版本的发行说明。

The Release Note will have a section titled Hardware and Software Requirements , and within that a sub-section titled Required JDK Versions . 该发行说明将包含一个标题为“ 硬件和软件要求 ”的小节,以及一个名为“ 必需的JDK版本 ”的小节。

For Release 4.1 the answer is : 对于4.1版,答案是

GlassFish Server Open Source Edition Release 4.1 requires Oracle JDK 7 Update 65 or later, or Oracle JDK 8 Update 20 or later . GlassFish Server开源版4.1版需要Oracle JDK 7 Update 65或更高版本,或者Oracle JDK 8 Update 20或更高版本

Notes: 笔记:

  • The word " later " in the part stating " Oracle JDK 8 Update 20 or later " is ambiguous, but it is referring only to the update level for the specified JDK version. 表示“ Oracle JDK 8 Update 20或更高 版本 ”的部分中的“ 稍后 ”一词是不明确的,但它仅指的是指定JDK版本的更新级别。 Do not interpret " later " as implying that Glassfish 4.1 might work with Java 9 or higher. 不要将“ 稍后 ”解释为暗示Glassfish 4.1可能与Java 9或更高版本一起使用。 It would be much clearer if the wording was: 如果措辞是:

    GlassFish Server Open Source Edition Release 4.1 requires Oracle JDK 7 using Update 65 or later, or Oracle JDK 8 using Update 20 or later. GlassFish Server开源版4.1版要求使用 Update 65或更高版本的Oracle JDK 7,或使用 Update 20或更高版本的Oracle JDK 8。

  • It is incorrect to state that " Glassfish 4.1 will work with Java 7 or Java 8 ", because in both cases a minimum update level is also required. 声明“ Glassfish 4.1将与Java 7或Java 8一起使用 ”是不正确的,因为在两种情况下都需要最低更新级别。

  • You can also get the minimum JDK requirements from Glassfish itself. 您还可以从Glassfish本身获得最低的JDK要求。 Under the root of the unzipped download in a file named README.TXT there is a section titled 0. Prerequisite . 在名为README.TXT的文件中,未压缩下载的根目录下有一个标题为0的部分。 For Glassfish 4.1 it is worth noting that the information given conflicts with that in the Release Note!... 对于Glassfish 4.1,值得注意的是,给出的信息与发行说明中的​​信息冲突!...

    GlassFish 4.1 requires Oracle JDK 7 Update 65+ or Oracle JDK 8 Update 5+. GlassFish 4.1需要Oracle JDK 7 Update 65+或Oracle JDK 8 Update 5+。

    In the odd cases where the requirements in the documentation conflict I'd always be inclined to choose the higher update level, and most of the time this is unlikely to be an issue. 在文档中的要求冲突的奇怪情况下,我总是倾向于选择更高的更新级别,并且在大多数情况下,这不太可能成为问题。

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

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