Java::Build::JVM is a Perl module that starts one JVM for compiling.
my $compiler = Java::Build::JVM->getCompiler();
$compiler->compile([ qw(list.java of.java programs.java) ]);
This class starts a single JVM which it then helps you contact for compiling tasks. This is the most important feature of the popular Ant build tool. Using this class, you can effectively replace Ant, and its notoriously unmaintainable build.xml files, with Perl scripts. Most Ant tasks are already built in to Perl with far more flexibility than Ant provides.
To obtain a compiler, use this module, then call getCompiler. It has that name to prevent conflicts with the Java new keyword.
Once you have a compiler, you may change the destination of subsequent compiles from the location of the source files to a directory of your choice using the destination method. You can create or append to a classpath with the classpath or append_to_classpath methods. Note that your CLASSPATH environment variable still works in its usual way.
Finally, once you have the destination and classpath set, you can compile a list of files by passing them to the compile method. Note that they need to be in an array reference (if you don't know what that means, put the list in square brackets).
Note that you must have tools.jar in your CLASSPATH when you run your script. Without that, JVM.pm will not be able use Inline::Java. The classpath you use inside the script may be the same or different than your environment variable, depending on how you use the classpath and append_to_classpath methods.
Since Sun has, in its finite wisdom, chosen to deprecate the compiling methods that javac uses, there will be one warning for each time you call compile. It will say something like this:
Note: sun.tools.javac.Main has been deprecated.
This warning is not a problem in Java 1.4.