Google App Engine 是否支持 Java 8?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26169557/
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
Does Google App Engine support Java 8?
提问by 512damon
Trying to get started with Google App Engine - does it work with Java 8?
尝试开始使用 Google App Engine - 它是否适用于 Java 8?
I've followed the instructions on this page: https://console.developers.google.com/start/appengine
我已按照此页面上的说明进行操作:https: //console.developers.google.com/start/appengine
Selecting 'Java', I successfully completed the Maven build, but when I visit localhost:8080 nothing is running.
选择“Java”,我成功完成了 Maven 构建,但是当我访问 localhost:8080 时没有任何运行。
The instructions say "make sure you have Java 7 JDK installed" however I have just installed Java 8 JDK.
说明说“确保您安装了 Java 7 JDK”但是我刚刚安装了 Java 8 JDK。
Do I need to separately install Apache?
我需要单独安装Apache吗?
采纳答案by Patrice
[The passage of time has changed the 'no' from this accepted answer to 'yes'. Please see others answers below.]
[随着时间的推移,这个公认的答案的“不”变成了“是”。请参阅下面的其他答案。]
Short answer, no. They will integrate it over time, but for now if you use it, it will cause you a lot of errors. I would recommend against it
简短的回答,没有。他们会随着时间的推移集成它,但是现在如果你使用它,它会给你带来很多错误。我会建议反对它
Also take note of user7610's answer below :). It is as of now the only way to have Java 8 on the Cloud Platform
还要注意下面 user7610 的回答:)。这是目前在云平台上安装 Java 8 的唯一方法
回答by crb
Java 8 is now generally available on App Engine Standard Environment, joining the GA runtime on the App Engine Flexible Environment.
Java 8 现在在 App Engine 标准环境中普遍可用,加入了 App Engine 柔性环境上的 GA 运行时。
了解差异。
The new Java 8 runtime has all the benefits of Java 7 but with upgrades and enhancements:
新的 Java 8 运行时具有 Java 7 的所有优点,但具有升级和增强功能:
- OpenJDK 8-based Java runtime supports the standard public Java library (no whitelist)
- Doesn't impose a security manager--your code won't be restricted by Java permissions issues.
- 基于 OpenJDK 8 的 Java 运行时支持标准的公共 Java 库(无白名单)
- 不强加安全管理器——您的代码不会受到 Java 权限问题的限制。
回答by Andrejs
Not at the time of writing but you can keep track of the status in this issue:
不是在撰写本文时,但您可以跟踪此问题的状态:
- Java 8 support: https://code.google.com/p/googleappengine/issues/detail?id=9537
回答by user7610
Update: it is available in the "standard" (sandboxed) offering since mid 2017, https://cloud.google.com/blog/products/gcp/java-8-on-app-engine-standard-environment-is-now-generally-available
更新:自 2017 年年中以来,它在“标准”(沙盒)产品中可用,https://cloud.google.com/blog/products/gcp/java-8-on-app-engine-standard-environment-is-现在普遍可用
Before then, it was sort-of available, via Managed VMs. The idea is that you provide a Docker container with whatever software you need (like Java 8) and GAE will use that as your app instance VMs. You still get the autoscaling, monitoring and all that.
在此之前,它可以通过托管虚拟机获得。这个想法是你提供一个带有你需要的任何软件(比如 Java 8)的 Docker 容器,GAE 将使用它作为你的应用程序实例虚拟机。您仍然可以获得自动缩放、监控等功能。
The disadvantage is that you are charged as for the Compute Engine VMs. That means you pay by minute and there is no free quota. There is the $300 credit for new user accounts for 60 days, but after that you'd have to pay.
缺点是您需要为 Compute Engine 虚拟机付费。这意味着您按分钟付费,并且没有免费配额。新用户帐户有 60 天的 300 美元信用额度,但之后您必须付款。
回答by Stijn Van Bael
If your interest is in using lambda expressions on Google App Engine, you could give Retrolambdaa try. I haven't tried it yet, but it claims to backport Java 8 lambda expressions to Java 7.
如果您对在 Google App Engine 上使用 lambda 表达式感兴趣,可以尝试一下Retrolambda。我还没有尝试过,但它声称将 Java 8 lambda 表达式向后移植到 Java 7。
回答by Dagang
Google App Engine Java 8 support is generally available as of Q3 2017. https://cloud.google.com/appengine/docs/standard/java/runtime-java8
Google App Engine Java 8 支持从 2017 年第 3 季度开始全面提供。https://cloud.google.com/appengine/docs/standard/java/runtime-java8
回答by Amir Rouzrokh
yes it does. We just launched this to Beta and soon GA.
是的,它确实。我们刚刚将其发布到 Beta 版,并很快发布到 GA。
https://cloudplatform.googleblog.com/2017/06/Google-App-Engine-standard-now-supports-Java-8.html
https://cloudplatform.googleblog.com/2017/06/Google-App-Engine-standard-now-supports-Java-8.html
回答by Ludo
App Engine Standard Java now supports Java8. See the Beta documentation at: Java8 on GAE Standard documentation
App Engine Standard Java 现在支持 Java8。请参阅以下位置的 Beta 文档:Java8 on GAE 标准文档
Thanks
谢谢
回答by Alien
Add <runtime>java8</runtime>
to your appengine-web.xml file.
添加<runtime>java8</runtime>
到您的 appengine-web.xml 文件。
回答by Ian
It's not quite the same thing, but you can use Java 8 with the new App Engine "flexible environment". I don't think you can access App Engine APIs (such as the images service or task queues) but you'll be able to use services which live outside of App Engine, such as the Datastore and Pub/Sub.
这并不完全相同,但您可以将 Java 8 与新的 App Engine“灵活环境”一起使用。我认为您无法访问 App Engine API(例如图像服务或任务队列),但您将能够使用位于 App Engine 之外的服务,例如数据存储区和 Pub/Sub。
It's also worth bearing in mind that the service is currently in beta (so not covered by any SLAs). Also, the pricing is different; instead of using the normal App Engine pricing structure, it's based on usage of GCE virtual machines.
还值得记住的是,该服务目前处于测试阶段(因此未包含在任何 SLA 中)。此外,定价不同;它不是使用正常的 App Engine 定价结构,而是基于 GCE 虚拟机的使用情况。