Reputation: 6269
I just tried to compile a small prog for testing purposes in java. I added the Google Calendar library and to test whether it works I tried the following codes.
package googlemaptest;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.client.calendar.CalendarService.Versions;
/**
*
* @author vimal
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("VErsion testing ..........."+CalendarService.CALENDAR_SERVICE );
System.out.println("VErsion testing ..........."+CalendarService.DEFAULT_VERSION );// this is line 24 in my codes
}
}
I expected it to return me the calendar version and its name but in return it returned me something like this:
VErsion testing ...........cl
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code
at googlemaptest.Main.main(Main.java:24)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I profiled the file and it came up wd the following exceptions
init: profile-init: Deleting: D:\Program Files\NetBeans 6.8\googleMapTEst\build\built-jar.properties deps-jar: Updating property file: D:\Program Files\NetBeans 6.8\googleMapTEst\build\built-jar.properties init: deps-clean: Updating property file: D:\Program Files\NetBeans 6.8\googleMapTEst\build\built-clean.properties Deleting directory D:\Program Files\NetBeans 6.8\googleMapTEst\build clean: Created dir: D:\Program Files\NetBeans 6.8\googleMapTEst\build\classes Created dir: D:\Program Files\NetBeans 6.8\googleMapTEst\build\empty Compiling 1 source file to D:\Program Files\NetBeans 6.8\googleMapTEst\build\classes compile-single: profile-single: Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 9) Profiler Agent: Established local connection with the tool VErsion testing ...........cl 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 googlemaptest.Main.main(Main.java:24) 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 Profiler Agent: Connection with agent closed Profiler Agent: Connection with agent closed Profiler Agent: Initializing... Profiler Agent: Options: >D:\Program Files\NetBeans 6.8\profiler3\lib,5140,10< Profiler Agent: Initialized succesfully Java Result: 1 BUILD SUCCESSFUL (total time: 4 seconds)
Since I am using this library for the first time, I do not have much knowledge about the exception. Can anyone tell me why this is happening and how I can sort this out?
Upvotes: 2
Views: 601
Reputation: 8312
The error message means that there was a compiler error. But the code looks fine. Perhaps it is outdated? In Eclipse: Try Project | Clean.
Eclipse will tell you about compile errors in the "Problems View" (Not the "Error View which is for bugs in Eclipse itself). You can open it with Window | Show View | Problems.
Upvotes: 1
Reputation: 1499830
My guess is that you're trying to run the code in Eclipse, which does let you run code which hasn't actually compiled successfully.
Look at the compiler errors. They will help you out.
Upvotes: 2