TOBA

Using Toba


Toba combines components of a Java program to build an executable file or a package of precompiled classes. Components can be source files, class files, object files, or library files.

When building an executable, at least one component should contain a single static void main(String []) method. The first such method becomes the initial entry point if not overridden by the -m option.

A package is a collection of classes, their generated headers, and their generated machine code. Packages are roughly analogous to C libraries. Classes are compiled once and collected into a package for subsequent linking with other packages. Packages are created with the -P flag. The colon-separated paths in the TOBAPATH environment variable are searched for precompiled classes at compile time.

Synopsis

toba [options] file...

Example: toba -o myprog main.java helper.java more.java

Options

-A string add string to arguments passed to cc
-a string add string to arguments passed to cc at link time
-c  compile to .o files but do not link
-C  produce C files but do not compile or link
-d flags set debugging flags for Toba
-g  pass -g (enable debugging) to cc
-i  retain intermediate files upon exit
-I path set the include path for the C compiler
-J  use interpreted versions of javac and Toba
-K  produce class files from Java source but go no further
-m classname Select classname as the main class to begin execution.
-o filename write executable to filename instead of a.out
-O  pass -O (enable optimization) to javac and cc
-P dirname build a package in directory dirname instead of compiling an application
-r  recursively incorporate all referenced classes
-S  produce .s files but do not assemble or link
-v  ("verbose") list shell commands as executed
-w  pass -nowarn (suppress warning messages) to javac
-X  use directly executable javac and Toba (default)

File Arguments

file.java Java source file to compile and link
file.class Java class file to translate and link
file.c C source file to compile and link
file.o object file to link
file.a library to link
file.so library to link
-lxxx library to link (cannot be the first file named)
-Lxxx library path to search for libraries (cannot be the first file named)
-Rxxx library path to embed in binaries (for Solaris; cannot be the first file named)
classname  Java class to link from $CLASSPATH or $TOBAPATH

Environment Variables

The following environment variables affect execution of a Toba-built program:
TOBA_HEAP Initial size of allocated memory, in bytes.
TOBA_HEAP_MAX Maximum size of allocated memory, in bytes.
TOBA_NOCOLLECT Inhibits garbage collection if set.
TOBAPATH Sets the toba.class.path system property. (At translation time, controls the searching for pre-compiled packages.)
CLASSPATH Sets the java.class.path system property. (At translation time, affects searching for class files.)
JAVA_HOME Sets the java.home system property.
In addition, any environment variable starting with TOBA_ is passed to the program as a system property. The name is formed by stripping the TOBA_ prefix and the value is that of the environment variable.

Caveats

Java class files must be available for all superclasses of class files processed by Toba. Classes are loaded from the path specified by the TOBAPATH and CLASSPATH environment variables, or, if not found there, from the current directory.

When the components of a program are compiled separately, .h files generated by toba -C must be available for all referenced classes. The current directory, the package directories specified by TOBAPATH, and any directories specified by -I are searched.

The toba script uses timestamps to find files created by intermediate steps. Concurrent execution of two toba scripts in the same directory, or significant time disagreement between client and file server, may result in incorrect builds.

The toba script must be executed by its true path, either explicitly or through the usual shell search mechanisms. Execution through a symbolic link in another directory does not work.


index | usage | differences | native code | implementation | porting | releases | installation || home
http://www.cs.arizona.edu/sumatra/toba/doc/usage.html (July, 1998)