Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!news.nosignal.org!news.xcski.com!ncf.ca!not-for-mail From: William Colls Newsgroups: comp.lang.java.help Subject: Beginners Problem - Class Definition Not Found Date: Fri, 22 Jul 2011 10:47:18 -0400 Organization: National Capital Freenet, Ottawa, Ontario, Canada Lines: 106 Sender: ft787@cpe002369f5842a-cm0012c9db4d68.cpe.net.cable.rogers.com Message-ID: NNTP-Posting-Host: cpe002369f5842a-cm0012c9db4d68.cpe.net.cable.rogers.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: theodyn.ncf.ca 1311346025 12579 99.224.92.37 (22 Jul 2011 14:47:05 GMT) X-Complaints-To: complaints@ncf.ca NNTP-Posting-Date: 22 Jul 2011 14:47:05 GMT User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:884 Environment: Kubuntu 10.04 patched up to date 64 bit. java version 1.6.0_24 Netbeans IDE 6.8 I am trying to set up a connection to my google calendar, using the information provided at the Google API web site. I have the following program, which builds correctly with the Netbeans IDE 6.8 If I understand the error message correctly, it is saying that it can't find a class definition for com.google.gdata.wireformats.AltRegistry. This class appears to be defined in gdata-core-1.0.jar. This file is in the library listing for Netbeans. At runtime, the CLASSPATH variable points to the folder that contains all the .jar files that are referenced by the import statements. So why doesn't the program find the class definition? // begin my program package google; 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.*; import sample.util.*; public class Calender { public static void main(String[] args) { CalendarService myService = null; URL feedUrl = null; CalendarFeed resultFeed = null; try { myService = new CalendarService("exampleCo-exampleApp-1.0"); myService.setUserCredentials("root@gmail.com", "pa$$word"); } catch(AuthenticationException ae) { System.out.println("Authentication Exception: " + ae.getMessage()); } try { feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full"); resultFeed = myService.getFeed(feedUrl, CalendarFeed.class); } catch(MalformedURLException mue) { System.out.println("URL Exception: " + mue.getMessage()); } catch(ServiceException se) { System.out.println("Service Exception: " + se.getMessage()); } catch (java.io.IOException ioe) { System.out.println("IO Exception: " + ioe.getMessage()); } 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()); } } } // end my program However when I try to run it I get the following error message: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:118) at com.google.gdata.wireformats.AltRegistry.(AltRegistry.java:100) at com.google.gdata.client.Service.(Service.java:555) at google.Calender.main(Calender.java:27) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 4 more I recognize that the credentials provided in the listing above are wrong. I will put the correct ones in when I get this thing to run. Thanks for your patience with a beginner in the wonderful world of java.