# javald - the wrapper creator for Java applications

- Synopsis
- Description
- Examples
- See Also

## SYNOPSIS

`javald [ -C` path`] [ -H` dir`] [ -j` option-list`] [ -o` outfile`] [ -R` path`]` classname

> Command-line Options
> `-C` path
>   Adds path to the run-time CLASSPATH. This specifies where java will search for Java classes. See Description for a discussion of the run-time evaluation of these pathnames.

>   The -C option can be repeated, such as:

>           example% javald -C /usr/class -C /optjava...

> `-H` dir
>   Sets JAVA_HOME to dir.
> `-j` option-list
>   Allows the set of options to be passed to the invocation of java to be set. If there are multiple options, they should be quoted to ensure that they are passed into the resulting wrapper.
> `-o` outfile
>   Places the wrapper in outfile.
> `-R` path
>   Adds path to the run-time LD_LIBRARY_PATH. This specifies where java will search for native methods. See Description for a discussion of the run-time evaluation of these pathnames.
> classname
>   The name of the class which has the `main` method.

> Back To Top

## DESCRIPTION

> The javald tool creates a convenient wrapper that captures the necessary environment needed to run a Java application specified by classname. If the -o option is provided, the resulting executable wrapper saved to file outfile. If the -o option is not specified, then the default output file name used is the name of the class.

> This wrapper sets the necessary environment variables needed by the java tool before it executes the class specified by classname.

> If the -H flag is specified, the wrapper sets JAVA_HOME to the path specified by the option. If -H option is not specified, the wrapper attempts to use the user's environment JAVA_HOME if set; otherwise it assumes a default JAVA_HOME of `/usr/java`.

> Paths specified as arguments to the -C and -R flags of the javald command are treated differently.

> The path arguments, which may include shell variables, are subject to deferred evaluation --that is, they are evaluated when the wrapper is executed.

> Relative pathnames are treated as pathnames relative to the directory where the wrapper is installed, not the current working directory.

> This behavior is designed to support applications that consist of several classes in a directory hierarchy rather than a single executable. Using relative pathnames allows this directory hierarchy (thus the application) to be more easily moved to different filesystems.

> The default CLASSPATH created by the wrapper if no -C options are used is equivalent to specifying -C.

> The default interpreter executed by the wrapper is $JAVA_HOME/bin/java.

> Back To Top

## Examples

> Example 1:

> > A wrapper called appl is created in directory /opt/acme/bin as follows:

> > > `example% javald -o /opt/acme/bin/appl -C /opt/acme/classes AcmeApp`

> > Suppose the wrapper contains the following environment variables:

> > > `JAVA_HOME=${JAVA_HOME:-/usr/java}
> > > CLASSPATH=/opt/acme/classes`

> > When appl is run, java will attempt to invoke the main() method of the AcmeApp class. The java interpreter will search for AcmeApp in /opt/acme/classes, then in the default system class directory, ${JAVA_HOME}/lib/classes.zip.

> Example 2:

> > The following command creates a script called MyApp:

> > > `example% javald -o myapp -j '-noverify -ms8m' MyApp`

> > Suppose it contains an invocation of the java interpreter that looks like:

> > > `example% exec {JAVA_HOME}/bin/java -noverify -ms8m MyApp`

> Back To Top

## SEE ALSO

> - `The Java Tutorial` for basic Java programming

Back To Top