作者rg550 (杰克)
看板java
标题[问题] 关於google map API的问题
时间Sat Feb 5 16:09:17 2011
我是依照网页上的程式码运行的:
http://0rz.tw/xB8XR
下为程式码:
package com.google.gdata.client.sample.maps;
import com.google.gdata.client.*;
import com.google.gdata.client.maps.*;
import com.google.gdata.data.*;
import com.google.gdata.data.maps.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.net.URL;
public class GetMapsFeed {
public static void main(String[] args) {
// Name your service
MapsService myService = new MapsService("applicationName");
try {
// Replace these credentials with your own
myService.setUserCredentials("rg550black","A127397450");
} catch(AuthenticationException e) {
}
try {
printUserMaps(myService);
} catch(ServiceException e) {
} catch(IOException e) {
}
}
public static void printUserMaps(MapsService myService)
throws ServiceException, IOException {
// Request the default metafeed
final URL feedUrl = new URL("
http://maps.google.com/maps/feeds/maps/default/full");
MapFeed resultFeed = myService.getFeed(feedUrl, MapFeed.class);
// Print the title of the feed itself.
System.out.println(resultFeed.getTitle().getPlainText());
// Iterate through the feed entries (maps) and print out info
// for each map
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
MapEntry entry = resultFeed.getEntries().get(i);
System.out.println(entry.getTitle().getPlainText());
System.out.println(" Summary: " + entry.getSummary().getPlainText());
System.out.println(" Self Link: " + entry.getSelfLink().getHref() +"\n");
}
}
}
但在run的时候,在这行:
MapsService myService = new MapsService("applicationName");
会有问题而进入
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
想请问是否有前辈有在使用google map API的可以帮我解答这个问题!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.84.27.29