JBuildTree

Go back to: Home Page



NEW Download JBuildTree 0.2.


New in version 0.2:
  1. Ability to pass options to javac.
  2. JBuildTree can not only compile class hierarchies but also install class files and clean up (by deleting all class files).

JBuildTree -- recursively compiles all java classes in a given directory

  1. Q: Why shouldn't I use "javac -depend" instead?
    A:It doesn't work if you have classes which are not statically referenced, e.g. classes which are loaded using Class.forName().

  2. Q: Why shouldn't I use a Makefile hierarchy?
    A:- A new JVM is started for every source to be compiled, which slows down the process drastically. The original incentive behind this program was to speed up compilation by avoiding the unnecessary overhead of starting many JVMs.
    - It's more complicated. You have to write many Makefiles.

  3. Q: What do I need to use JBuildTree?
    A: A copy of the JDK. Any version should do, although I have only tested it with JDK1.0.2 under Linux. Please note that JBuildTree was hacked together on one evening and hasn't been tested very well.

  4. Q: How do I install it?
    A: Include the "src" directory in your $CLASSPATH and put the supplied "jbt" script somewhere in your $PATH if you want to use it.

  5. Q: How do I use it?
    A: Set up $CLASSPATH to include your project's directories , then call "java szeiger.jbuildtree.JBuildTree " where is a list of directories that contain your project's sources and class files. On most Unix systems you should be able to use the supplied script. E.g.: "jbt src". JBuildTree then scans the directories for sources that need to be compiled, deleting outdated classes on the way, and calls sun.tools.javac.Main.main() with the list of sources. Make sure that non-public classes which are not in a source file of their own are only used by classes in the same source file! I think "javac- depend" can handle this case, but JBuildTree can't!

  6. Q: Is it worth all the trouble?
    A: A full compile of all classes in a bigger project that consists of several dozend classes took about 6 minutes with a Makefile hierarchy and 2 minutes with JBuildTree. So, yes, I think it's worth all the trouble :-)

Standard disclaimer stuff: Distribute freely as long as you don't modify it. Use it at your own risk. Send modifications to me.


Stefan Zeiger