33

this is hopefully something simple but... Eclipse has been working relatively fine for everything except deploying to GAE.

I can run my GAE app locally, but when I try to deploy to google, I get this message:

java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE.

I have set the build path to JDK.

It also happens when trying to deploy the same project from more than one system (win7 and win8) so I suspect the problem is to do with the project itself. This particular project is existing and already running on google for years.

Interesting that this error only shows up when I have .jsp files in my app to deploy. If I remove the jsp files, it deploys without error. (kinda need the jsp files tho)

thanks

link to image of my build path

101chris
  • 867
  • 2
  • 10
  • 17
  • 1
    possible duplicate of [unable to deploy after upgrading to 1.7.4](http://stackoverflow.com/questions/13890054/unable-to-deploy-after-upgrading-to-1-7-4) – durron597 Dec 20 '12 at 01:17

6 Answers6

60

I had the same problem and was able to deploy successfully after forcing Eclipse to use the JRE within my SDK directory (Win 7 64bit). To force Eclipse to use a particular JRE see this. It seems that the JVM that Eclipse uses, the JVM that app engine spawns, & the JVM that appconfig uses should all be the same. Hope this helps w/ your situation as well.

AlohaCode
  • 764
  • 6
  • 4
  • 2
    Thank you! When I edited eclipse.ini and set eclipse's VM to the same jdk as the GAE project's build path, the error went away. (C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe, in my case, win7x64 too.) – 101chris Dec 19 '12 at 23:57
  • Wow your a lightsaber! +1! – Joe M Mar 06 '13 at 16:06
  • 2
    Please take note that when specifying the -vm argument, it needs to be the first line of the eclipse.ini file. the -vm argument is on the first line, the second line contains the path to the javaw.exe file. – mrmuggles Apr 12 '13 at 03:30
  • 2
    @mrmuggles that is not true. As long as the -vm argument is above the -vmargs argument, you're good to go. From the link AlohaCode posted: `The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.` – Mark Tielemans Apr 13 '13 at 16:06
  • @MarkTielemans I was putting it at the end and it wasn't working and I saw somewhere that it has to be the first line. Thanks for the precision. ;) – mrmuggles Apr 16 '13 at 00:56
  • 3
    TL;DR: Edit your eclipse.ini . E.g. under Windows 7, add the following to eclipse.ini: `-vm`, then newline, then `C:\Program Files (x86)\Java\jdk1.7.0_07\bin\javaw.exe` (yes, don't use quotes, and yes, edit the path to fit your actual installation location). ... In case your eclipse.ini contains `-vmargs` stuff, make sure that all `-vm` stuff comes first, then comes all `-vmargs` stuff. – Abdull May 24 '13 at 03:00
  • Just want to confirm that this is still an issue and that above solution worked for me. – Yogi Mar 24 '14 at 00:33
12

I tried setting my project jre to be the same as my eclipse jre according to AlohaCode's answer. This was insufficient for me. The answer was in my classpath, there is java.exe in C:\windows\system32 which was BEFORE my java home variable. The solution is to put the java home path before the C:\windows\system32 entry. I found the answer here: 2FL5sJ">https://groups.google.com/forum/?fromgroups=#!msg/google-appengine-java/RyFybJWUhU4/78UE_2FL5sJ

bitrock
  • 1,254
  • 1
  • 12
  • 17
  • Where does one find classpath? – Yster Jan 09 '16 at 16:10
  • On windows 10: Control Panel\System and Security\System -> Advanced system settings -> Advanced -> Environment Variables. Then look for the system variable named "path" – bitrock Mar 11 '16 at 05:14
  • This does work for me! I needed to move "%JAVA_HOME%/bin" to the head of the PATH entries. – alextc Aug 22 '16 at 04:34
2

In Eclipse, go to: Window->Preferences->Java->Installed JREs , add->Standard VM TO JDK PATH\JRE. and If you had a JRE checked previously uncheck it and check this jre

  • 1
    After updating `JAVA_HOME`, the `PATH`, and `eclipse.ini` without any luck, this finally worked for me. But I also had to update the project to use the JDK jre: Configure Build Path... > Libraries > Add Library > JRE System Library > Workspace default JRE (jdk1.8.xxx), and then remove the previous one from the Libraries list. – Tyler C. Sep 09 '17 at 21:13
2

The given advice solved my problem. The -vm argument cannot be the first line.

-vm

C:\Program Files (x86)\Java\jdk1.7.0_51\bin\javaw.exe
tashuhka
  • 5,028
  • 4
  • 45
  • 64
Deepak
  • 29
  • 3
0

Setting -vm in eclipse.ini did not help. All other settings were seemingly pointing to the JDK. Out of desperation, I uninstalled all JREs from my system, leaving only the JDK. The consequence was that Eclipse would not start as the JDK bin directory was not on my PATH (Windows 8 here). Adding this in environment system variables got Eclipse to start. Thereafter I could deploy to app engine.

Agnes
  • 654
  • 6
  • 11
-2

Removing the JRE file located in my C:/Program Files(*86)/Java folder , reopening the eclipse IDE resolved the issue.

I had Java JDK installed in my C:/Program Files/Java folder which was not detected earlier.

R3uK
  • 14,417
  • 7
  • 43
  • 77
  • this is not an optimal solution as it may potentially have knock on effects to other Application. – Caleryn May 18 '15 at 12:37