Next: , Previous: Warnings, Up: Invoking gcj

1.5 Linking

To turn a Java application into an executable program, you need to link it with the needed libraries, just as for C or C++. The linker by default looks for a global function named main. Since Java does not have global functions, and a collection of Java classes may have more than one class with a main method, you need to let the linker know which of those main methods it should invoke when starting the application. You can do that in any of these ways:

These gij options relate to linking an executable:

This option is used when linking to specify the name of the class whose main method should be invoked when the resulting executable is run.
This option can only be used with --main. It defines a system property named name with value value. If value is not specified then it defaults to the empty string. These system properties are initialized at the program's startup and can be retrieved at runtime using the java.lang.System.getProperty method.
Create an application whose command-line processing is that of the gij command.

This option is an alternative to using --main; you cannot use both.