13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.4 Compiling Our Simple <str<strong>on</strong>g>Applicati<strong>on</strong></str<strong>on</strong>g> with gcj183TIPThe 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.htmlhttp://www.multitool.net/pubkey.html:Michael Schwarz's Public GPG keyMichael Schwarz's Public GPG Key-----BEGIN PGP PUBLIC KEY BLOCK-----Versi<strong>on</strong>: GnuPG v1.0.7 (GNU/<strong>Linux</strong>)mQGiBDuv6IQRBACn1TIWUXiEuZtfR+0Lqx6tYBAzIRpljL42O6r5nKHmndsWV71eFUnhQpQIf+bNGGPMEt0g0vFpD6YWKP4uIEh2o+u1iyIIMs5QH3iqp8kFjbtVZa21.........etc.We already explained the -o switch which names the resulting binary. Theother switch we use here is --main which specifies the class c<strong>on</strong>taining themain() that should be run when the binary is invoked. Remember that everyJava class may c<strong>on</strong>tain a main(). In a multiclass program, the binary needs toknow which main() to run when the binary is executed.Remember that FetchURL is in the default package, 11 so you simplytype the class name as the argument to --main. However, if the class is in an<strong>on</strong>default package, the fully qualified name must be used.11. Any class without a package declarati<strong>on</strong> is in the default package.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!