简体   繁体   English

如何在Eclipse for Google App Engine中从Java 7切换到Java 6?

[英]How to switch from Java 7 to Java 6 in Eclipse for Google App Engine?

I have developed a small application with Google Web Toolkit and would like to deploy it to the Google App Engine (GAE) server. 我已经使用Google Web Toolkit开发了一个小型应用程序,并希望将其部署到Google App Engine(GAE)服务器。 I'm using Eclipse Juno and Java 7 by default, but when I tried to deploy to GAE, I realised that it does not support Java 7 yet. 我默认使用Eclipse Juno和Java 7,但是当我尝试部署到GAE时,我意识到它还不支持Java 7。 So I switched to a Java 6 JRE in the project setting (set Build Path/Libraries to "java-6-openjdk-amd64" and Java Compiler/Compiler compliance level to 1.6. 因此,我在项目设置中切换到Java 6 JRE(将Build Path / Libraries设置为“ java-6-openjdk-amd64”,并将Java Compiler / Compiler遵从级别设置为1.6。

However, when I try to deploy my app via the Google Eclipse plugin, it still throws the same RuntimeException: 但是,当我尝试通过Google Eclipse插件部署应用程序时,它仍会抛出相同的RuntimeException:

"The application contains Java 7 classes, but the --use_java7 flag has not been set." “该应用程序包含Java 7类,但未设置--use_java7标志。”

Here's the complete debugging output: 这是完整的调试输出:

Unable to update:
java.lang.RuntimeException: The application contains Java 7 classes, but the --use_java7 flag has not been set.
        at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:576)
        at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:370)
        at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:53)
        at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:433)
        at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148)
        at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

How can I remove the Java 7 remainders so that the Google plugin understands? 如何删除Java 7剩余部分,以便Google插件能够理解?

This is all running on Ubuntu 12.10 64 bit. 这些都在Ubuntu 12.10 64位上运行。

You are probably using your Java 7 installation to compile. 您可能正在使用Java 7安装进行编译。 In eclipse, go to Window > Preferences . 在eclipse中,转到窗口>首选项 In there, browse to Java > Installed JREs . 在其中,浏览至Java>已安装的JRE

The list on the right probably only shows the jre/jdk7 in your case. 在您的情况下,右侧的列表可能仅显示jre / jdk7。 You have to add your installation of Java 5 or 6 in here, and make sure that it is the "ticked" JRE. 您必须在此处添加Java 5或6的安装,并确保它是“选中的” JRE。

Afterwards, use Project > Clean... , select "Clean All Projects" and make sure that "Start a build immediatly" is ticked, along with "build the entire workspace". 然后,使用“ 项目”>“清理...” ,选择“清理所有项目”,并确保选中“立即开始构建”以及“构建整个工作区”。

[Edit : this answer is not accurate for android development... When I realized that, a quck search showed that the question looks suspiciously close to Failed to deploy to Google App Engine because --use_java7 flag has not been set , the answer is probably the same.] [编辑:此答案不适用于android开发...当我意识到这一点时,快速搜索显示该问题看起来可疑接近于由于未设置--use_java7标志无法部署到Google App Engine ,答案是大概一样。]

我最终能提供帮助的唯一方法是在Eclipse中创建一个新项目,立即切换到Java 6(构建路径,编译器,Java facet),然后复制/粘贴上一个项目中的所有文件和GAE设置。

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

相关问题 将Google App Engine应用程序(Java)导入Eclipse - Importing Google App Engine App (Java) to Eclipse 如何将用户界面包含到Google App Engine Java的Eclipse中? - How to include user interface into eclipse for google app engine java? 如何在Eclipse中重新启动Google App Engine Java Server? - How do I restart the Google App Engine Java Server in Eclipse? 谷歌应用程序引擎:切换sql云数据库实例,保持源代码与java eclipse相同 - google app engine : switch sql cloud database instance , keeping the source code same java eclipse 如何从谷歌应用程序引擎为java调用谷歌应用程序脚本 - how to call a google app script from google app engine for java 适用于Google电子钱包的Java Eclipse Google App Engine教程 - Java Eclipse Google App Engine Tutorial for Google Wallet 使用gcloud app deploy部署Google App Engine Java Eclipse项目 - Deploy Google App Engine Java Eclipse project with gcloud app deploy 如何从Google App Engine(Java)将图像检索到JSP中 - How to retrieve image into the jsp from the google app engine(java) 如何从Google App Engine数据存储区(Java)正确检索int? - How to correctly retrieve int from a Google App Engine datastore (Java)? Google App Engine Java是否支持Eclipse中的热部署? - Does Google App Engine Java support Hot Deployment in Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM