When I'm working with Google GData Java client
API in Eclipse environment, I found a numerous problems and errors. The problems were found in package
com.google.gdata.data.apt which uses a number of classes from
com.sun.mirror.apt package, actually a standard package of recent JDK bundled. And Eclipse recognize the package and all the classes as undefined ones.
Well, I have already followed the GData "Get Started" instructions and added all libraries needed. After googling for almost an hour - which is kinda waste of time.- finally I found out an answer. And it had to do with my understanding of
Eclipse inclusion of JRE and JDK library.. surprising enough given that it is too basic !
I always assume that "Java library" in Eclipse workspace is a JDK one if we have it installed. But I was wrong, since Eclipse only include JRE library - not the JDK part.
So, what I'm going to do is to add
tools.jar - a jar that has com.sun.mirror.apt.* classes - from JDK distribution into my Eclipse project.
To add it as external jar, here are the steps :
- Navigate to Project=>Properties menu
- Click on Java Build Path in left side navigation
- Click at Libraries tag
- Click on Add External JARs
- Navigate into your JDK library folder, for example C:\Program Files\Java\jdk1.5.0_15\lib
- Choose tools.jar and click Open button
- Click OK
- Done
Figure 1 : JRE jars and the added JDK's tools.jarSo for those who also develop Java application using
GData Java API with Eclipse, I write this article in a hope that it can be a time savior for you facing the same problem.
Thank You for Visiting,