简体   繁体   中英

How do I load up Google Collections Library in Eclipse?

I'm currently trying to learn to use Guava so I downloaded the source by doing this:

svn checkout http://guava-libraries.googlecode.com/svn/trunk/ guava-libraries-read-only

Sorry if this sounds really stupid but for the life of me, I can't figure out how to load up the source in Eclipse to examine it. I've tried different ways (creating, importing, etc) but always end up with package problems.

I'm using Eclipse 3.5 on Ubuntu by the way.

Can I get some help on this? Thanks!

EDIT: I'm trying to examine the source so I would like to add the source as a project.

Here is what I would do...

  1. Go to the downloads page and grab the latest bundled release
  2. Unzip it to some local directory
  3. Copy the guava-r<version>.jar to your project's lib directory.
  4. Right click on the JAR from Eclipse and say "Add to Build Path".

If you need the source you can attach the guava-r<version>-src.jar in Eclipse via the Configure Build Path project menu or by using the attach source button during debug.

It's easiest to download a Jar from the Guava site , copy it into your Eclipse project and add it to the build path using the jar context menu > Build Path > Add to Build Path . Also, point Eclipse to the included source zip using project context menu > Configure Build Path... to get Javadoc on the Guava classes.

I have done it two ways: the Subclipse and Maven eclipse plugins. Both offer "create project from repository"-like options. Both plugins have reasonable online help, so I'll not repeat exact steps here.

Creating a project from the repositories will give you a full view of the source (and documentation, build files, etc).

I might be a little late in answering ... but you could also simply install the guava bundle from the update site " guava-bundle "; it will install the sources along and you'll then just have to import the plugins in your workspace (File > Import > plugins and fragment... don't forget to tick the "projects with source folder" checkbox on the first page of this wizard) and browse the source from it.

Note that this update site has now been discontinued in profit of Guava-osgi which also provide an update site for easy installation ... but I haven't installed it yet and thus don't know whether the sources are included in the artifacts installed through this update site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM