Eclipse, AppEngine: java.lang.RuntimeException: Ca

2019-03-25 00:23发布

I'm getting this error when trying to deploy to Google AppEngine. I DO have JDK selected!

------------ Deploying frontend ------------

Preparing to deploy:
    Created staging directory at: 'C:\Users\Chloe\AppData\Local\Temp\appcfg8759974391667459604.tmp'
    Scanning for jsp files.
    Compiling jsp files.
java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.

Debugging information may be found in C:\Users\Chloe\AppData\Local\Temp\appengine-deploy6465203991005024943.log

C:\Users\Chloe\AppData\Local\Temp\appengine-deploy6465203991005024943.log:

Unable to update:
java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
    at com.google.appengine.tools.admin.Application.compileJavaFiles(Application.java:814)
    at com.google.appengine.tools.admin.Application.compileJsps(Application.java:801)
    at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:615)
    at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:418)
    at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:55)
    at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:433)
    at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:155)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

Imgur

Imgur

I've cleaned the project, re-installed Eclipse to latest version, re-installed all plugins, etc. I've also edited Program Files\Java\eclipse-kepler-4.3\eclipse.ini with

-vm
C:\Program Files\Java\jdk1.7.0_17\bin\javaw.exe

at the top and before -vmargs.

4条回答
唯我独甜
2楼-- · 2019-03-25 01:05

WOW!!! I was dealing with this issue for like 3-4 hours. Was just about to comment saying fuck this. But then I changed the eclipse.ini to:

-vm
A:/Programming/Java/jdk1.8.0_73/bin/javaw.exe

instead of:

-vm
A:/Programming/Java/jdk1.7.0_79/bin/javaw.exe

AND SUCCESS!

Why this might have worked? Not really sure. I needed 1.7 not 1.8... but 1.7 kept pointing to a JRE instead of the JDK... And surprisingly 1.8 didn't do that + still worked with the current build. Also worth mentioning to specify 1.7 in facets /build path & compiler..

enter image description here

查看更多
相关推荐>>
3楼-- · 2019-03-25 01:17

In my case I was trying to File>Restart the Eclipse but not working when exited and run again It works

查看更多
Emotional °昔
4楼-- · 2019-03-25 01:24

Go to Eclipse folder where you have eclipse installed (say c:\eclipse). You will find eclipse.ini file which eclipse uses to while starting. Add the following line -vm C:\Program Files\Java\jdk1.7.0_25\bin\javaw.exe

change the above java path with your location of JDK. It should be able to use this JDK and will compile and deploy to app engine.

查看更多
对你真心纯属浪费
5楼-- · 2019-03-25 01:27

I see that the OP is using Google Plugin for Eclipse (GPE), which is deprecated, but this was once also a problem in Cloud Tools for Eclipse (CT4E), so I'll leave a relevant answer for CT4E here for reference.

It was indeed a bug of Cloud Tools for Eclipse that it did not use the JDK configured for a project but instead used the JDK used to launch Eclipse for staging. The bug has been fixed: https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2195.

So, others answers in this question to edit eclipse.ini to change the JDK to launch Eclipse are a temporary workaround that is no longer needed. Just update to the latest CT4E version and set a JDK for a project. You can specify whatever JDK/JRE necessary in eclipse.ini for launching Eclipse.

查看更多
登录 后发表回答