0
votes

Google analytics posted on their blog about an example Java program to extract data and output to a CSV using the analytics api, im trying to compile this program to run it in eclipse but running into problems

http://code.google.com/p/ga-api-java-samples/source/browse/trunk/src/v2/DataOverTime/src/example/MainDemo.java

i have changed out the variables in here to my own:

// User configurations.
  private static final String USERNAME = "INSERT_YOUR_GOOGLE_ACCOUNT_LOGIN";
  private static final String PASSWORD = "INSERT_YOUR_GOOGLE_ACCOUNT_PASSWORD";
  private static final String TABLE_ID = "INSERT_YOUR_TABLE_ID";

i'm unsure on the next step, when i try to run the program i get this error message:

    Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

    at MainDemo.main(main.java:51)

update:

ok, its says when using the google analytics API i need to reference some .jar files:

gdata-core-1.0.jar gdata-client-meta-1.0.jar gdata-client-1.0.jar gdata-analytics-meta-2.0.jar gdata-analytics-2.0.jar google-collect-1.0-rc1.jar jsr305.jar

i put these in but its still not working i get the following error message:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Results cannot be resolved to a type
    The method getData(DataQuery) from the type DataOverTime refers to the missing type Results
2

2 Answers

0
votes

Is your directory structure correct? It should look somewhat like the url of the example. The file has to be './example/MainDemo.java' and compile it from '.'