Generate a Custom DrJava jar File

This week, I have worked on a couple of DrJava projects:

  1. Generate Custom drjava.jar
  2. New Language Level Support

The second project, a simplified language level facility, is mainly Corky’s work, I’m just helping to integrate it into the main part of DrJava.

The first project, the ability to bundle other libraries and classes with DrJava, was a request by Barbara Ericson for use with the Media Computation classes at Georgia Tech.
As of revision 5232, this feature has been implemented and merged into the trunk.

  • There is a Tools/Advanced/Generate Custom drjava.jar menu item that takes the current DrJava executable file and a number of user-specified files to generate a new jar file.
  • The user can select any number of jar and zip files or directories to be added. When a directory is added, all files in that directory and its subdirectories will be added recursively.
  • When the “Generate” button is pressed, DrJava then performs a check to see if the added libraries could interfere with DrJava itself and perhaps with each other. This is done using MD5 hashes.
  • DrJava will write out a new drjava.jar file to the file specified by the user.
  • The libraries included in the new jar file will then automatically be included in the classpath and be usable without adding them to a classpath somewhere.
  • This works in the jar file, the Windows exe file, and the Mac application.
  • However, DrJava will ONLY be able to write a jar file, not create a Windows exe file or a Mac application.
  • There is no functionality to remove the libraries again from the modified jar file.
  • Generating a custom DrJava jar file disables the check for updated versions. Otherwise a user may download an updated version that doesn’t have required libraries anymore.
  • The added files and directories appear in the version line of DrJava to provide minimal help, e.g. "DrJava Version : drjava-20100423-r5230 with foo.jar, bar.jar".

I’ll still have to do more specific tests with the Media Computation classes. As Mark Guzdial explained to me: “Right now, we include jmusic, javazoom, and various class files into our classes — see http://mediacomputation.org for either the Java CS1 or Data Structures classes.”

This is probably also of interest to anyone who uses the ACM classes.

Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in DrJava. Bookmark the permalink.

2 Responses to Generate a Custom DrJava jar File

  1. Pingback: A Concurrent Affair » Blog Archive » Simplified Language Levels

  2. Pingback: Three Branches and a Trunk | A Concurrent Affair

Leave a Reply