Run the new API

14 views
Skip to first unread message

MrZizou

unread,
May 4, 2009, 3:59:24 PM5/4/09
to google-analytics-api - GA Data Export API
Hi all,
I am a little confused trying to run the new API with Java. Do I need
to build any of the class-files myself ? It seems like the
com.google.gdata.util-package is missing in the libs but not in the
docs... ? Is there a reason for this?

Have someone created a .jar file that I can download, point to in my
classpath and then import and use those classes in my java-source
file?

BR
Johan

Nick

unread,
May 5, 2009, 12:23:43 AM5/5/09
to google-analytics-api - GA Data Export API
Hi,

For Java all our client libraries are bundled with the GData core
library which you can download the latest version here :
http://code.google.com/p/gdata-java-client/downloads/list
Once downloaded, you need to include all the analytics specific jars
and core libraries in your class path.
Finally you can use one of our examples to see how to get data using
these libraries : http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v1/AccountFeedExample.java

I hope this helps get you started,
-Nick

vpascual

unread,
May 12, 2009, 12:18:42 PM5/12/09
to google-analytics-api - GA Data Export API
Hi.

When I run the example code from
http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v1/AccountFeedExample.java
I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/
common/collect/Maps
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:
118)
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:
100)
at com.google.gdata.client.Service.<clinit>(Service.java:512)
at AccountFeedExample.main(AccountFeedExample.java:40)
Caused by: java.lang.ClassNotFoundException:
com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I've added all the jars, as pointed out in
http://code.google.com/intl/es/apis/analytics/docs/gdata/1.0/gdataJava.html#ClientLogin
Thank you for your help

On May 5, 6:23 am, Nick wrote:
> Hi,
>
> ForJavaall our client libraries are bundled with the GData core
> library which you can download the latest version here :http://code.google.com/p/gdata-java-client/downloads/list
> Once downloaded, you need to include all the analytics specific jars
> and core libraries in your class path.
> Finally you can use one of our examples to see how to get data using
> these libraries :http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/...
>
> I hope this helps get you started,
> -Nick
>
> On May 4, 12:59 pm, MrZizou wrote:
>
> > Hi all,
> > I am a little confused trying to run the new API withJava.  Do I need

Nick

unread,
May 12, 2009, 2:09:09 PM5/12/09
to google-analytics-api - GA Data Export API
Ok...

What operating system, Java version are you using.

-Nick

On May 12, 9:18 am, vpascual wrote:
> Hi.
>
> When I run the example code fromhttp://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/...
> I get the following error:
>
> Exception in thread "main" java.lang.NoClassDefFoundError: com/google/
> common/collect/Maps
>         at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:
> 118)
>         at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:
> 100)
>         at com.google.gdata.client.Service.<clinit>(Service.java:512)
>         at AccountFeedExample.main(AccountFeedExample.java:40)
> Caused by: java.lang.ClassNotFoundException:
> com.google.common.collect.Maps
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>
> I've added all the jars, as pointed out inhttp://code.google.com/intl/es/apis/analytics/docs/gdata/1.0/gdataJav...

vpascual

unread,
May 13, 2009, 4:04:09 AM5/13/09
to google-analytics-api - GA Data Export API
I'm using Linux/Ubuntu woth java version "1.6.0_07"

vpascual

unread,
May 13, 2009, 6:20:51 AM5/13/09
to google-analytics-api - GA Data Export API
I've also tried the same code with Windows XP and the latest Java
version and I'm still getting the same error.
By the way, I'm running the example in Eclipse, with the following
jars:

- activation.jar
- maril.jar
- sevlet-api.jar
- gdata-analytics-1.0.jar
- gdata-analytics-meta-1.0.jar
- gdata-base-1.0.jar
- gdata-client-1.0.jar
- gdata-client-meta-1.0.jar
- gdata-core-1.0.jar

Thank you for your help

On May 12, 8:09 pm, Nick wrote:

ShoreTel

unread,
May 13, 2009, 8:14:22 PM5/13/09
to google-analytics-api - GA Data Export API
In your error message above I see "com/google/common/collect/Maps".
Are you by chance using the Google Maps API?

vpascual

unread,
May 14, 2009, 3:16:40 AM5/14/09
to google-analytics-api - GA Data Export API
Not at all. That's really strange. I'm getting crazy, as I'm following
the instructions from Google and I'm unable to start working with GA
API.

vpascual

unread,
May 14, 2009, 3:38:27 AM5/14/09
to google-analytics-api - GA Data Export API
I finally get it to work, adding the google-collect-1.0-rc1.jar to the
classpath of my app.
Hope that will help somebody with the same problem...
Reply all
Reply to author
Forward
0 new messages