[問題] 關於google map API的問題
我是依照網頁上的程式碼運行的: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