Reputation: 3
I have been using Appengine to try and work with the Google+ API. Unfortunately, Appengine has not worked since I began working on my project. Recently, I ran into a major problem when attempting to run an application based off of the following tutorial: http://www.youtube.com/watch?v=tVIIgcIqoPw. The error is as follows: An error occurred for ClassEnhancer "ASM" when trying to call the method "Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/appengine/tools/enhancer/Enhance : Unsupported major.minor version 51.0". I received the error after trying to "clean" the project in Eclipse.
Here is the current code I am using:
package com.example.myproject;
import com.google.api.client.extensions.appengine.http.UrlFetchTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.plus.Plus;
import com.google.api.services.plus.PlusRequestInitializer;
import com.google.api.services.plus.model.Activity;
import com.google.api.services.plus.model.ActivityFeed;
import java.io.IOException;
import java.io.Writer;
import java.util.List;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class PlusBasicServlet extends HttpServlet {
private static final String API_KEY = "AIzaSyBggyzruOQtog0A6HDlrxGvK2JdLV5ihNE";
private static final long serialVersionUID = 1;
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
HttpTransport httpTransport = new UrlFetchTransport();
JsonFactory jsonFactory = new JacksonFactory();
Plus plus = new Plus.Builder(httpTransport, jsonFactory, null).setApplicationName("").setGoogleClientRequestInitializer(new PlusRequestInitializer(API_KEY)).build();
ActivityFeed myActivityFeed = plus.activities().search("Google").execute();
List<Activity> myActivities = myActivityFeed.getItems();
resp.setContentType("text/html");
resp.setStatus(200);
Writer writer = resp.getWriter();
writer.write("<url>");
for(Activity a: myActivities){
writer.write("<li>" + a.getTitle() + "</li>");
}
writer.write("</ul>");
}
}
Any suggestions or help would be greatly appreciated.
Upvotes: 0
Views: 115
Reputation: 2619
This error occurs because your using a java version under 1.7.
Run your project with JRE 1.7, and it will be good.
EDIT
Google App Engine does not support java 8 yet, as you can see on this issue.
It's coming soon.
So you have to downgrade your Java environment.
Upvotes: 1