Installing the Data Source Java Library

This page describes how to use or modify the Google Visualization Java library, and how to contribute to the open source code for the project.

Contents

Requirements

You must have the following components in order to use the Google Visualization Java library:

  • A servlet container and the Servlet API version 2.4 or higher. One of the most commonly used servlet containers is Apache Tomcat, which includes the Servlet API. See http://tomcat.apache.org/download-55.cgi to download the binary for version 5.5. You need install only the Core module. You also need Tomcat to complete the tutorial sections: Getting Started, Using an External Data Store, and Defining Capabilities and the Flow of Events.
  • The Java Development Kit version 6.0 or greater.

    Note: It is also possible to use the JDK version 5.0. However, you must then remove @Override from every method in the library that overrides an interface method. This is due to the change in the @Override annotation behavior in JDK version 6.0.

Dependencies

The data source Java library has the following dependencies. The library was tested with the versions listed; other versions might be acceptable, but have not been tested.

Included in the source or download:

Not included in the source or download:

Using the Library as Provided

This section describes how to use the visualization Java library if you don't need to modify it. This process varies with your build system:

If using Maven, set up a dependency on the visualization library with the following settings:

  • Group ID: com.google.visualization
  • Artifact ID: visualization-datasource
  • Version number: Use the latest version number listed on the project page.

If using any other build system:

Running the Examples

The JAR example files are included along with the library JARs in the downloadable ZIP file. Instructions on running the examples are given on the Getting Started page.

Modifying the Library

If you want to modify the library code, you'll have to download the source from the open source hosting site and build it. Before doing this, read the licensing information linked to by the "Code license" section on the project page to see whether your use case is allowed.

Here are the steps for downloading and building the library:

  1. Download the source code using SVN, as described in on the Source > Checkout tab on the open source project page.
  2. Build your code. If building in Maven, use the pom.xml file provided with the source. If building with Apache Ant, follow the instructions given next (note that the code has been tested with Ant version 1.7.0; if you have an earlier version of Ant, you might need to upgrade)

Ant Build Instructions

1. Modify your build properties:

  1. Navigate to the build-src subdirectory of your chosen installation directory.
  2. Using a text editor, open the build.properties file and make the following changes:
    • Edit the servlet-api.jar property to point to your servlet-api.jar file. For example, if you installed Tomcat to your c: drive in the tomcat_home directory, then you would specify the servlet-api.jar property as follows:
      servlet-api.jar=C:/tomcat_home/common/lib/servlet-api.jar

      Note: Use forward slashes rather than backslashes in the file path, even when using Windows

    • To use your own copies of the dependencies described above, edit the paths in the same build.properties file.

2. Build the library:

Navigate the build-src subdirectory in the file and type one of the following:

  • ant datasource - Builds the data source library
  • ant example - Builds the examples
  • ant - Builds both data source and examples
  • ant test - Builds and runs the data source library tests. Very useful when you are modifying the library.

Contributing to the Open Source Project

If you want to contribute changes to the open source project, you'll have to get submission permissions to the project. Send an email to google-visualization-api@googlegroups.com asking for permission and instructions on how to submit changes.

Send feedback about...