%scons; %builders-mod; %functions-mod; %tools-mod; %variables-mod; ]> Sets construction variables for the &javac; compiler. JAVAC JAVACFLAGS JAVACCOM JAVACLASSSUFFIX JAVAINCLUDES 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 portability, it's best if the encoding is hard-coded, so that the compilation works when run on a system with a different encoding. env = Environment() env['ENV']['LANG'] = 'en_GB.UTF-8' Specifies the location of the bootstrap class files. Can be specified as a string or Node object, or as a list of strings or Node objects. The value will be added to the JDK command lines via the option, which requires a system-specific search path separator. This will be supplied by &SCons; as needed when it constructs the command line if &cv-JAVABOOTCLASSPATH; is provided in list form. If &cv-JAVABOOTCLASSPATH; is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified; and so is inherently system-specific; to supply the path in a system-independent manner, give &cv-JAVABOOTCLASSPATH; as a list of paths instead. Can only be used when compiling for releases prior to JDK 9. Specifies the location of the annotation processor class files. Can be specified as a string or Node object, or as a list of strings or Node objects. The value will be added to the JDK command lines via the option, which requires a system-specific search path separator. This will be supplied by &SCons; as needed when it constructs the command line if &cv-JAVAPROCESSORPATH; is provided in list form. If &cv-JAVAPROCESSORPATH; is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified; and so is inherently system-specific; to supply the path in a system-independent manner, give &cv-JAVAPROCESSORPATH; as a list of paths instead. New in version 4.5.0 Include path for Java header files (such as jni.h). 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 &b-link-JavaH; builder. Specifies the class search path for the JDK tools. Can be specified as a string or Node object, or as a list of strings or Node objects. Class path entries may be directory names to search for class files or packages, pathnames to archives (.jar or .zip) containing classes, or paths ending in a "base name wildcard" character (*), which matches files in that directory with a .jar suffix. See the Java documentation for more details. The value will be added to the JDK command lines via the option, which requires a system-specific search path separator. This will be supplied by &SCons; as needed when it constructs the command line if &cv-JAVACLASSPATH; is provided in list form. If &cv-JAVACLASSPATH; is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will be split on the separator into a list of individual paths for dependency scanning purposes. It will not be modified for JDK command-line usage, so such a string is inherently system-specific; to supply the path in a system-independent manner, give &cv-JAVACLASSPATH; as a list of paths instead. &SCons; always supplies a when invoking the Java compiler &javac;, regardless of the setting of &cv-link-JAVASOURCEPATH;, as it passes the path(s) to the source(s) supplied in the call to the &b-link-Java; builder via . From the documentation of the standard Java toolkit for &javac;: If not compiling code for modules, if the or option is not specified, then the user class path is also searched for source files. Since is always supplied, &javac; will not use the contents of the value of &cv-JAVACLASSPATH; when searching for sources. The suffix for Java class files; .class by default. Specifies the list of directories that will be searched for input (source) .java files. Can be specified as a string or Node object, or as a list of strings or Node objects. The value will be added to the JDK command lines via the option, which requires a system-specific search path separator, This will be supplied by &SCons; as needed when it constructs the command line if &cv-JAVASOURCEPATH; is provided in list form. If &cv-JAVASOURCEPATH; is a single string containing search path separator characters (: for POSIX systems or ; for Windows), it will not be modified, and so is inherently system-specific; to supply the path in a system-independent manner, give &cv-JAVASOURCEPATH; as a list of paths instead. Note that the specified directories are only added to the command line via the option. &SCons; does not currently search the &cv-JAVASOURCEPATH; directories for dependent .java files. The suffix for Java files; .java by default. Specifies the Java version being used by the &b-link-Java; builder. Set this to specify the version of Java targeted by the &javac; compiler. 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 a version greater than 1.4 makes &SCons; realize that a build with such a compiler is actually up-to-date. The default is 1.4. While this is not primarily intended for selecting one version of the Java compiler vs. another, it does have that effect on the Windows platform. A more precise approach is to set &cv-link-JAVAC; (and related &consvars; for related utilities) to the path to the specific Java compiler you want, if that is not the default compiler. On non-Windows platforms, the alternatives system may provide a way to adjust the default Java compiler without having to specify explicit paths.