Sets construction variables for the &javac; compiler.
JAVAC
JAVACFLAGS
JAVACCOM
JAVACLASSSUFFIX
JAVASUFFIX
JAVABOOTCLASSPATH
JAVACLASSPATH
JAVASOURCEPATH
JAVACCOMSTR
Builds one or more Java class files.
The sources may be any combination of explicit
.java files,
or directory trees which will be scanned
for .java files.
SCons will parse each source .java file
to find the classes
(including inner classes)
defined within that file,
and from that figure out the
target .class files that will be created.
The class files will be placed underneath
the specified target directory.
SCons will also search each Java file
for the Java package name,
which it assumes can be found on a line
beginning with the string
package
in the first column;
the resulting .class files
will be placed in a directory reflecting
the specified package name.
For example,
the file
Foo.java
defining a single public
Foo
class and
containing a package name of
sub.dir
will generate a corresponding
sub/dir/Foo.class
class file.
Examples:
env.Java(target = 'classes', source = 'src')
env.Java(target = 'classes', source = ['src1', 'src2'])
env.Java(target = 'classes', source = ['File1.java', 'File2.java'])
Java source files can use the native encoding for the underlying OS.
Since SCons compiles in simple ASCII mode by default,
the compiler will generate warnings about unmappable characters,
which may lead to errors as the file is processed further.
In this case, the user must specify the LANG
environment variable to tell the compiler what encoding is used.
For portibility, it's best if the encoding is hard-coded
so that the compile will work if it is done on a system
with a different encoding.
env = Environment()
env['ENV']['LANG'] = 'en_GB.UTF-8'
Specifies the list of directories that
will be added to the
&javac; command line
via the option.
The individual directory names will be
separated by the operating system's path separate character
(: on UNIX/Linux/POSIX,
; on Windows).
The Java compiler.
The command line used to compile a directory tree containing
Java source files to
corresponding Java class files.
Any options specified in the &cv-link-JAVACFLAGS; construction variable
are included on this command line.
The string displayed when compiling
a directory tree of Java source files to
corresponding Java class files.
If this is not set, then &cv-link-JAVACCOM; (the command line) is displayed.
env = Environment(JAVACCOMSTR = "Compiling class files $TARGETS from $SOURCES")
General options that are passed to the Java compiler.
The directory in which Java class files may be found.
This is stripped from the beginning of any Java .class
file names supplied to the
JavaH
builder.
Specifies the list of directories that
will be searched for Java
.class file.
The directories in this list will be added to the
&javac; and &javah; command lines
via the option.
The individual directory names will be
separated by the operating system's path separate character
(: on UNIX/Linux/POSIX,
; on Windows).
Note that this currently just adds the specified
directory via the option.
&SCons; does not currently search the
&cv-JAVACLASSPATH; directories for dependency
.class files.
The suffix for Java class files;
.class
by default.
Specifies the list of directories that
will be searched for input
.java file.
The directories in this list will be added to the
&javac; command line
via the option.
The individual directory names will be
separated by the operating system's path separate character
(: on UNIX/Linux/POSIX,
; on Windows).
Note that this currently just adds the specified
directory via the option.
&SCons; does not currently search the
&cv-JAVASOURCEPATH; directories for dependency
.java files.
The suffix for Java files;
.java
by default.
Specifies the Java version being used by the &b-Java; builder.
This is not currently used to select one
version of the Java compiler vs. another.
Instead, you should set this to specify the version of Java
supported by your &javac; compiler.
The default is 1.4.
This is sometimes necessary because
Java 1.5 changed the file names that are created
for nested anonymous inner classes,
which can cause a mismatch with the files
that &SCons; expects will be generated by the &javac; compiler.
Setting &cv-JAVAVERSION; to 1.5
(or 1.6, as appropriate)
can make &SCons; realize that a Java 1.5 or 1.6
build is actually up to date.