采用进口Eclipse插件,谷歌日历API问题 [英] importing google calendar api problem using eclipse plugin
问题描述
我导入谷歌日历API罐子使用谷歌提供的Eclipse插件我当前的项目。
下面是我做的的http:// code。 google.com/eclipse/docs/googleapis.html
和这里就是我要做的。
HTTP://$c$c.google。 COM /的API /日历/数据/ 2.0 / developers_guide_java.html
我遇到在编译时错误。我没有得到任何错误或警告,而编码
错误
编译模块com.shuttle.reservation.ShuttleWebsite
验证新编译单位
[错误]中的错误'file:/C:/Users/user1/Desktop/Dropbox/All/Everything%20Programming/workspace/ShuttleWebsite/src/com/shuttle/reservation/client/ShuttleWebsite.java'
[错误] 129行:没有源$ C $ C可用的类型com.google.gdata.client.calendar.CalendarService;你忘记继承所需的模块吗?
[错误] 134行:没有源$ C $ C可用的类型的java.net.URL;你忘记继承所需的模块吗?
[错误]第135行:没有源$ C $ C可用的类型com.google.gdata.data.calendar.CalendarFeed;你忘记继承所需的模块吗?
[错误] 142行:没有源$ C $ C可用的类型com.google.gdata.data.calendar.CalendarEntry;你忘记继承所需的模块吗?
[错误] 146行:没有源$ C $ C可用的类型com.google.gdata.util.AuthenticationException;你忘记继承所需的模块吗?
[错误] 149行:没有源$ C $ C可用的类型java.net.MalformedURLException;你忘记继承所需的模块吗?
[错误] 155行:没有源$ C $ C可用的类型com.google.gdata.util.ServiceException;你忘记继承所需的模块吗?
找到切入点班
[错误]找不到类型'com.shuttle.reservation.client.ShuttleWebsite
[错误]提示:previous编译器错误可能犯这种类型的不可用
[错误]提示:检查你的模块继承链;它可能不被继承所需模块或模块可能没有正确加其源路径条目
从控制台窗口中的一些附加误差
异常线程mainjava.lang.NoClassDefFoundError的:COM /谷歌/普通/收集/地图
在com.google.gdata.wireformats.AltRegistry<&初始化GT;(AltRegistry.java:118)
在com.google.gdata.wireformats.AltRegistry<&初始化GT;(AltRegistry.java:100)
在com.google.gdata.client.Service< clinit>(Service.java:555)
在AppsProvisioning.main(AppsProvisioning.java:37)
抛出java.lang.ClassNotFoundException:引起com.google.common.collect.Maps
在java.net.URLClassLoader的$ 1.run(来源不明)
在java.security.AccessController.doPrivileged(本机方法)
在java.net.URLClassLoader.findClass(来源不明)
在java.lang.ClassLoader.loadClass(来源不明)
在sun.misc.Launcher $ AppClassLoader.loadClass(来源不明)
在java.lang.ClassLoader.loadClass(来源不明)
... 4个
和这里是code,我不知道该怎么办。我用谷歌的Eclipse插件的设置项目中,我不知道为什么它不工作。你能帮助我
进口com.google.gdata.client *。
导入com.google.gdata.client.calendar *。
导入com.google.gdata.data *。
导入com.google.gdata.data.acl *。
导入com.google.gdata.data.calendar *。
进口com.google.gdata.data.extensions *。
导入com.google.gdata.util *。进口java.net *。
进口java.io. *;。
。
。
。
// ------------日历服务---------------------------------- -----------
CalendarService为myService =新CalendarService(exampleCo-ExampleApp中-1.0); 尝试{
myService.setUserCredentials(jo@gmail.com,输入mypassword); 网址feedUrl =新的URL(http://www.google.com/calendar/feeds/default/allcalendars/full);
CalendarFeed resultFeed = myService.getFeed(feedUrl,CalendarFeed.class); textBox.setText(日历);
//System.out.println(\"Your日历:);
//System.out.println(); 的for(int i = 0; I< resultFeed.getEntries()大小();我++){
。CalendarEntry进入= resultFeed.getEntries()获得(I)
//System.out.println(\"\\t+ entry.getTitle()getPlainText())。
textBox_1.setText(entry.getTitle()getPlainText());
}
}赶上(的AuthenticationException E){
// TODO自动生成catch块
e.printStackTrace();
}赶上(MalformedURLException的E){
// TODO自动生成catch块
e.printStackTrace();
}赶上(IOException异常五){
// TODO自动生成catch块
e.printStackTrace();
}赶上(ServiceException E){
// TODO自动生成catch块
e.printStackTrace();
}
}。
。
。
您没有得到正确的范围。 GWT不能导入所有的Java类到客户端codeS。比如像CalendarService或其他日历API类都应该在服务器端写入,而不是客户端。
请仔细阅读本教程中,我想你应该混合在一起的服务器和客户端code。
I imported the google calendar api jars to my current project using the eclipse plugin provided by google.
here is how I did it http://code.google.com/eclipse/docs/googleapis.html
and here is what I am trying to do
http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html
I encounter an error at compilation time. I get no errors or warnings while coding
error
Compiling module com.shuttle.reservation.ShuttleWebsite
Validating newly compiled units
[ERROR] Errors in 'file:/C:/Users/user1/Desktop/Dropbox/All/Everything%20Programming/workspace/ShuttleWebsite/src/com/shuttle/reservation/client/ShuttleWebsite.java'
[ERROR] Line 129: No source code is available for type com.google.gdata.client.calendar.CalendarService; did you forget to inherit a required module?
[ERROR] Line 134: No source code is available for type java.net.URL; did you forget to inherit a required module?
[ERROR] Line 135: No source code is available for type com.google.gdata.data.calendar.CalendarFeed; did you forget to inherit a required module?
[ERROR] Line 142: No source code is available for type com.google.gdata.data.calendar.CalendarEntry; did you forget to inherit a required module?
[ERROR] Line 146: No source code is available for type com.google.gdata.util.AuthenticationException; did you forget to inherit a required module?
[ERROR] Line 149: No source code is available for type java.net.MalformedURLException; did you forget to inherit a required module?
[ERROR] Line 155: No source code is available for type com.google.gdata.util.ServiceException; did you forget to inherit a required module?
Finding entry point classes
[ERROR] Unable to find type 'com.shuttle.reservation.client.ShuttleWebsite'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
some additional error from the console window
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
at com.google.gdata.client.Service.<clinit>(Service.java:555)
at AppsProvisioning.main(AppsProvisioning.java:37)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
and here is the code and I dont know what to do. I used googles eclipse plugin setup my project I dont know why it is not working. can you help me out
import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.acl.*;
import com.google.gdata.data.calendar.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.*;
import java.io.*;
.
.
.
.
//------------ Calendar Service ---------------------------------------------
CalendarService myService = new CalendarService("exampleCo-exampleApp-1.0");
try {
myService.setUserCredentials("jo@gmail.com", "mypassword");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
textBox.setText("Your calendars");
//System.out.println("Your calendars:");
//System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
//System.out.println("\t" + entry.getTitle().getPlainText());
textBox_1.setText(entry.getTitle().getPlainText());
}
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
.
.
.
You didn't get the scope right. GWT cannot import all Java classes into client codes. Things like CalendarService or other Calendar API classes are supposed to be written in server side, not client side.
Please read the tutorial carefully, I think you should be mixing the server and client code together.
这篇关于采用进口Eclipse插件,谷歌日历API问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!