public class Precompile
extends java.lang.Object
Constructor and Description |
---|
Precompile() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] params)
You can run the class stand alone via this method.
|
java.lang.String[] |
precompile(java.lang.String[] inputDirs,
java.lang.String[] outputDirs,
boolean force,
java.lang.String[] switches)
This is the routine to precompile all *.pre / *.java files in a given directory.
|
public java.lang.String[] precompile(java.lang.String[] inputDirs, java.lang.String[] outputDirs, boolean force, java.lang.String[] switches)
inputDirs
- In which directories are the .pre source files? ALL Java
source files in these directories will be precompiled.outputDirs
- In which directories to put the precompiled source files.
They do not have to exist, they will be created automatically if needed.force
- A boolean to force overwriting the contents of any existing
output directories before writing to them. If force is false, and an
output directory is not empty, a GeneralSecurityException is thrown.switches
- Any <DEFINES> to be used as precompile options.
Can be null if none should be applied.public static void main(java.lang.String[] params)
Parameters in detail:
-i <directory>
The directory containing the input source files. All *.pre / *.java files in this directory will be precompiled. You can give multiple directories with-idir1 -idir2 -idir3 ...
.-o <directory>
(Optional) The directory to where the precompiled source files will be written. You can give multiple directories in the same way as it is explained above for the -i switch.
If you don't give output directories, Precompile.java will try to find a "package" statement in the source file, and use the package name as the output directory for that file. The method of finding the package name should be rather robust, but in case it fails, this is, you don't find the resulting file in the correct directory, specify the output directories with the -o switch(es). Also, if you prefer to put the output files into another directory, than the package name implies, you have to use -o .-q
(Optional) Quiet mode. Don't output anything except for errors.-f
(Optional) Force overwriting existing files in the output directories. Precompile.java will not overwrite contents in the output directory by default.
When using Precompile.java without -o switch, you might first want to test without -f to see, if Precompile.java outputs to the directories you think. In following precompiles, you can then add the -f switch.-D<switch>
(Optional) Any switch to be used for precompilation. You can have any number of -D options.
params
- An array of Strings. See above for a more detailed
explanation of possible parameters.