GAE getting started in Java, Eclipse Indigo - can't compile as 1.6
Asked Answered
A

3

2

I feel like I keep going in circles with this one. I followed the Getting Started guide for Google App Engine (https://developers.google.com/appengine/docs/java/gettingstarted/) in Eclipse and everything went relatively well until I uploaded it to the App Engine.

I was getting 500 errors so I checked the logs and found this: "guestbook/SignGuestbookServlet : Unsupported major.minor version 51.0]"

I then search for this problem (on stackoverflow, of course) and found this solution: Google App Engine and Java Version?

So I set the compliance level to 1.6 and then at the bottom of the dialog I get the warning that "When selecting 1.6 compliance, make sure to have a compatible JRE installed and activated (currently 1.7)".

I happy click OK, and it prompts for a rebuild. After the rebuild I then get this new error: "Java compiler level does not match the version of the installed Java project facet."

Not having knowingly used any facets in the project I do a search for some help (again on stackoverflow) and find this: "Faceted Project Prblem (Java Version Mismatch)" error message

Unfortunately it is not even close to being helpful because I am not used Maven, and when I bring up the properties of the project there is no Project Properties -> Project Facets panel for me to change a version on.

So it seems that I am stuck with something that either cannot be compiled in Eclipse or cannot be deployed to App Engine. I know that I am probably missing something obvious here but I can't quite put my finger on it.

UPDATE: I have uninstalled all JREs and JDKs, and reinstalled only jdk1.6.0_32. The problem continues exactly the same.

Alkalosis answered 22/5, 2012 at 1:20 Comment(2)
Try installing JDK6 and running Eclipse under it.Confident
Hi @peter, I just tried running eclipse using the -vm jdk1.6.0_31 in the INI file (previously was jdk1.7.0_04) and it didn't make any differenceAlkalosis
L
7

I had the same problem. I was able to resolve by using the Navigator view and editing the .settings/org.eclipse.wst.common.project.facet.core.xml, changing to:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <installed facet="java" version="1.6"/>
</faceted-project>

After this change, the error went away and I could successfully run the GWT project in DevMode using jre1.7 but java 1.6 compliance level.

It really seems there should be a way to edit this java facet via project configuration, but I couldn't find it in Juno.

Laval answered 25/8, 2012 at 20:7 Comment(1)
This is still a solution with ADT 22 as well. Thank you.Ramachandra
A
2

The answer, at least in my case, seems to be that if your Eclipse default compiler level is set to 1.7 when you create the Web Application then you can't switch it down to 1.6 successfully.

Example 1: Using JRE 1.6

  1. In eclipse set Preferences->Java->Installed JREs to jdk 1.6.0_32
  2. Set Preferences->Java->Compiler to compliance level 1.6
  3. Use google plugin to create "New Web Application"
  4. Run it locally - success
  5. Deploy to app engine, run remotely - success

Example 2: Using JRE 1.7

  1. In eclipse set Preferences->Java->Installed JREs to jdk 1.7.0_04
  2. Set Preferences->Java->Compiler to compliance level 1.7
  3. Use google plugin to create "New Web Application"
  4. Run it locally - success
  5. Upload to app engine - failure (Unsupported major.minor version 51.0)
  6. In eclipse set Preferences->Java->Compiler to compliance level 1.6 - failure (won't compile locally (Java compiler level does not match the version of the installed Java project facet).

Solution:

Before using the google plugin to create the Web Application, switch the JRE and compiler level to 1.6 (as seen in example 1).

If your project already exists, then hopefully you haven't got too far with it and can create it again.

Alkalosis answered 23/5, 2012 at 5:39 Comment(0)
T
2

After fighting this issue for a few hours, deleting my nocache.js in the war folder was the final piece of the puzzle.

Contrary to the answer above, I was able to succesfully downgrade to compliance level 1.6 after creating the application in 1.7

Tailback answered 15/10, 2012 at 8:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.