Java Reference
In-Depth Information
TIP
The source code for FetchURL can be found in Example 3.30.
Example 7.1 Compiling and running FetchURL with gcj
$ gcj -o furl --main=FetchURL FetchURL.java
$ ./furl http://www.multitool.net/pubkey.html
http://www.multitool.net/pubkey.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Michael Schwarz's Public GPG key</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Michael Schwarz's Public GPG Key</H1>
</CENTER>
<PRE>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.7 (GNU/Linux)
mQGiBDuv6IQRBACn1TIWUXiEuZtfR+0Lqx6tYBAzIRpljL42O6r5nKHmndsWV71e
FUnhQpQIf+bNGGPMEt0g0vFpD6YWKP4uIEh2o+u1iyIIMs5QH3iqp8kFjbtVZa21
...
...
...
etc.
We already explained the -o switch which names the resulting binary. The
other switch we use here is --main which specifies the class containing the
main() that should be run when the binary is invoked. Remember that every
Java class may contain a main() . In a multiclass program, the binary needs to
know which main() to run when the binary is executed.
Remember that FetchURL is in the default package, 11 so you simply
type the class name as the argument to --main . However, if the class is in a
nondefault package, the fully qualified name must be used.
11. Any class without a package declaration is in the default package.
Search WWH ::




Custom Search