Instructions for the AdSense Host API V4.1 Command-Line Sample

Browse Online

Register Your Application

Checkout Instructions

Prerequisites: install Java 6, Mercurial, and Maven. You may need to set your JAVA_HOME .

cd [someDirectory]
hg clone google-api-java-client-samples
cd google-api-java-client-samples/adsensehost-cmdline-sample
[editor] src/main/resources/client_secrets.json
[editor] src/main/java/com/google/api/services/samples/adsensehost/cmdline/
(Set PUB_ACCOUNT_ID to your publisher account ID if you want the
publisher samples to run)
mvn compile
mvn -q exec:java

Setup Project in Eclipse

To enable logging of HTTP requests and responses (highly recommended when developing), please take a look at

Prerequisites: install Eclipse, the Mercurial plugin, and the Maven plugin.