Simple Java Builds

SCons User Guide 0.98.0
Prev | Chapter 2. Simple Builds | Next

# 2.3. Simple Java Builds

SCons also makes building with Java extremely easy. Unlike the `Program` and `Object` builder methods, however, the `Java` builder method requires that you specify the name of a destination directory in which you want the class files placed, followed by the source directory in which the `.java` files live:

         Java('classes', 'src')

If the `src` directory contains a single `hello.java` file, then the output from running the scons command would look something like this (on a POSIX system):

          % scons
          scons: Reading SConscript files ...
          scons: done reading SConscript files.
          scons: Building targets ...
          javac -d classes -sourcepath src src/hello.java
          scons: done building targets.

We'll cover Java builds in more detail, including building Java archive (`.jar`) and other types of file, in Chapter 24.

Prev | Home | Next
Building Object Files | Up | Cleaning Up After a Build