6

I have jre 7 installed and jdk 6u29. I can't install jre6 because an old version of it is stopping the install, I've tried removing all traces of it but it still telling me an old version is installed.

My question is can I develop for GoogleApp engine with jdk6 and jre7 combination? I keep getting error in my logs that indicate the class was compiled with the wrong version java?

James MV
  • 8,569
  • 17
  • 65
  • 96
  • 2
    This is the error I get: Uncaught exception from servlet java.lang.UnsupportedClassVersionError: guestbook/GuestbookServlet : Unsupported major.minor version 51.0 at com.goog – James MV Nov 15 '11 at 16:23

5 Answers5

5

Well, on GAE's page it doesn't say anything specific about JDk7, but I think that's just because the page hasn't been updated in a while. I can tell you that i do infact use JDK 7 with GAE (have done so for months) and everything's fine.

Normally the JRE doesn't enter in this equation, as running the GAE locally will still make use of the same JDK you use for dev. However if you indeed would manually try to run a JDK7 compiled class using JRE6 this would not work, but again, I don't think this is an issue in your context.

Shivan Dragon
  • 15,004
  • 9
  • 62
  • 103
  • 1
    So could you explain this error which I thought was due to using JRE7: Uncaught exception from servlet java.lang.UnsupportedClassVersionError: guestbook/GuestbookServlet : Unsupported major.minor version 51.0 at com.goog – James MV Nov 15 '11 at 16:36
  • 3
    because of this: http://www.java.net/node/664117. You've configured a different JDK (or JRE) in Eclipse than the one "officially" installed on your machine (the one declared in JAVA_HOME env var) which is used by the AppeEngine SDK. Make sure you add to Eclipse (or at least to that particular project) the JDK that is installed in the directory outputten by "echo $JAVA_HOME" (or "echo %JAVA_HOME%" if on win) – Shivan Dragon Nov 15 '11 at 16:46
  • That sorted it, I literally couldn't be more thankful. I've been playing with this since midnight yesterday! – James MV Nov 15 '11 at 16:59
  • @ShivanDragon. My JAVA_HOME is set to jdk7, build path is set to jdk7. The local version is running fine but when on GAE same error : Unsupported major.minor version 51.0, java.lang.UnsupportedClassVersionError. – 2sb Jul 26 '12 at 00:15
3

you can change your compiler version in eclipse using following steps

  1. Right click on project and take properties
  2. Change java compiler to the desired version
nidhin
  • 6,661
  • 6
  • 32
  • 50
2

Make sure Your

  • java Build Path (right click on you project > properties > Java Build Path > Libraries )
  • Java compiler (right click on you project > Properties > Java Compiler )

are point to same java version.

The easiest way to make it same is change the Project Facets

right click on you project > properties > Java (select the correct java version)
Labeeb Panampullan
  • 34,521
  • 28
  • 94
  • 112
1

If your classes were compiled with older version of Java (here I mean JDK) you can run these classes on new java VM(here I mean JRE), So, answer you can, but it is some strange situation...

Sergii Zagriichuk
  • 5,389
  • 5
  • 28
  • 45
  • Google say to use Java 6 or 5. But I can't install JRE6 because its got some left over install from a previous install. I'd like to just run JRE6 and JDK6. Thanks for your answers, heres to hoping it works. – James MV Nov 15 '11 at 16:21
0

If you use Android Studio (1.3) to develop Google AppEngine application, please don't use JDK 1.8 from Oracle as the Java tools, you should use JDK 1.7 instead.

Zephyr
  • 6,123
  • 34
  • 33