是否可以在 Glassfish 3 上使用 Java 8?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22462936/
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
Will it be possible to use Java 8 on Glassfish 3?
提问by Daniel Kaplan
We currently use Glassfish 3 and I really want to use Java 8. I tried upgrading to Glassfish 4, but I experienced two bugs in the Glassfish 4 code so I had to revert back to Glassfish 3. Will Glassfish 3 work with Java 8 or will I have to upgrade my application container?
我们目前使用 Glassfish 3,我真的很想使用 Java 8。我尝试升级到 Glassfish 4,但我在 Glassfish 4 代码中遇到了两个错误,所以我不得不恢复到 Glassfish 3。Glassfish 3 是否适用于 Java 8 或将我必须升级我的应用程序容器吗?
采纳答案by unwichtich
No, it won't be possible (at the moment, maybe a workaround will occur later).
不,这是不可能的(目前,也许稍后会出现解决方法)。
I tried Glassfish 3.1.1 and Glassfish 3.1.2.2 with the final Java 8 JDK which was released today. It doesn't even start the server, some OSGI exceptions are thrown.
我使用今天发布的最终 Java 8 JDK 尝试了 Glassfish 3.1.1 和 Glassfish 3.1.2.2。它甚至没有启动服务器,会抛出一些 OSGI 异常。
As the comment to your question showed, it doesn't even work with earlier builds of Glassfish 4.0.
正如对您的问题的评论所示,它甚至不适用于 Glassfish 4.0 的早期版本。
Update 2015:
2015 年更新:
It looks like there is a way to make it work with Glassfish 3.1.2.2.
看起来有一种方法可以使其与 Glassfish 3.1.2.2 一起使用。
Open the file /glassfish/domains/domain1/config/osgi.properties
of your Glassfish installation and add the following line at the end of the file: jre-1.8=${jre-1.7}
打开/glassfish/domains/domain1/config/osgi.properties
Glassfish 安装文件并在文件末尾添加以下行:jre-1.8=${jre-1.7}
This should make the server start with JDK 8. It still doesn't work for Glassfish 3.1 or 3.1.1.
这应该使服务器从 JDK 8 开始。它仍然不适用于 Glassfish 3.1 或 3.1.1。
See also:
也可以看看:
回答by max
Stopped by an error after upgrading my Java 7 to Java 8. Glassfish 3.1.2.2 just won't start.
将我的 Java 7 升级到 Java 8 后因错误而停止。Glassfish 3.1.2.2 无法启动。
Found a solution:
找到了解决办法:
edit osgi.properties
file in the glassfish/config
folder and add this line at the end:
编辑osgi.properties
文件glassfish/config
夹中的文件并在最后添加这一行:
jre-1.8=${jre-1.7}