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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

184Chapter 7The GNU Compiler for Java (gcj)7.4.2 Compiling a Multiclass ProgramFor c<strong>on</strong>trast, Example 7.2 shows compiling a multiclass program that isc<strong>on</strong>tained in a package (it is the Payback debt/savings/purchase calculator). 12Example 7.2 Compiling and running a multiclass program$ cd payback/src$ gcj -o payback -I. --main=net.multitool.Payback.Payback \net/multitool/Payback/Payback.java$ ./paybackPayback -- A savings/credit comparis<strong>on</strong> toolCopyright (C) 2003 by Carl Albing and Michael SchwarzReleased under the GNU/GPL. Free Software..........etc.The -I switch names a directory that is to be prepended to the classpath.In this case, we added “.” which is the source directory for the Paybackprogram. 13 Notice the package elements expressed with dots for the --mainargument, and with slashes for the filename argument.NOTEThe gcj compiler does pick up and use the CLASSPATH envir<strong>on</strong>ment variableif it is specified. Also, gcj has a number of switches besides -I for classpathmanipulati<strong>on</strong>. We w<strong>on</strong>’t cover those here; -I is the preferred method (accordingto the gcj manpage at any rate).12. Since this chapter was written, XML features were added to Payback that make it no l<strong>on</strong>gerwork with gcj.13. The Payback code can be found at the book’s Web site: http://www.javalinuxbook.com/.

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

Saved successfully!

Ooh no, something went wrong!