#253 Using Third Party Packages with DrJava


The user documentation does not go into much detail regarding the use of third-party packages with DrJava. I have DrJava Version drjava-20080904-r4668 running under Windows XPSP3. For example, I downloaded a package from Source Forge entitled JGraphT. (JGraphT is a free Java class library that provides mathematical graph-theory objects and algorithms. It runs on Java 2 Platform [requires JDK 1.6 or later]) The package comes in a zip file which I placed in my C:\_java folder which extracted into in a folder called: "C:\_java\jgrapht-0.8\jgrapht-0.8.1". In that folder is a series of subfolders (eg. .\etc, .\javadoc, .\lib, .\src, and .\testsrc) as well as a jar file (jgrapht-jdk1.6.jar). Now here's the problem...

When I compile the demo application (located C:\_java\jgrapht-0.8\jgrapht-0.8.1\src\org\jgrapht\demo\HelloJGraphT.java) it compiles without error, presumably because it is is a subfolder of the original package. However, I want to create separate application that refers to the JGraphT package as a library. As a test, I created my own folder (C:\_java\mydemoapp), changed the package name to mydemoapp (from org.jgrapht.demo), and recompiled (see attached file). However, since I'm working out of my own application package folder, DrJava no longer knows how to find the original JGraphT package.

File: C:\_java\mydemoapp\HelloJGraphT.java [line: 44]
Error: C:\_java\mydemoapp\HelloJGraphT.java:44: package org.jgrapht does not exist

I should be able to manually fix this problem for this package by adding a path to the JGraphT package either by updating the CLASSPATH environment variable or through DrJava settings, but I haven't figured out the right folder to point to. I also wouldn't want to have to do this for every package, as it would be more intuitive to set up a library of all packages in their own subfolders (or JARs?) . Is there a standard way of building libraries of packages where I can place packages of compiled classes or jar files in a specific location where DrJava can automatically find them?

Thanks in advance for your help.


  • Keith Brower

    Keith Brower - 2010-05-19



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks