SCons User Guide 0.96 | ||
---|---|---|
<<< Previous | Next >>> |
So far, we've been using examples of building C and C++ programs to demonstrate the features of SCons. SCons also supports building Java programs, but Java builds are handled slightly differently, which reflects the ways in which the Java compiler and tools build programs differently than other languages' tool chains.
The basic activity when programming in Java, of course, is to take one or more .java files containing Java source code and to call the Java compiler to turn them into one or more .class files. In SCons, you do this by giving the Java Builder a target directory in which to put the .class files, and a source directory that contains the .java files:
Java('classes', 'src') |
If the src directory contains three .java source files, then running SCons might look like this:
% scons -Q javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java |
SCons will actually search the src directory tree for all of the .java files. The Java compiler will then create the necessary class files in the classes subdirectory, based on the class names found in the .java files.
<<< Previous | Home | Next >>> |
Alias Targets | How SCons Handles Java Dependencies |