This is the online version of the CD-ROM for Java Programming on Linux, by Nathan Meyers.
Sources to the tools and examples in the book are provided in subdirectories named for the chapter in which the code is discussed. The specific code and subdirectories are:
The Java binaries for the following tools, utilities, and demos are packaged into a single Java archive, JavaLinuxBook.jar, in the top-level directory of the CD-ROM. You can add this single jarfile to your class path to use any of these programs:
Project |
Class Name |
SlideShow |
com.macmillan.nmeyers.SlideShow |
WaterFall |
com.macmillan.nmeyers.WaterFall |
ShowFonts11 |
com.macmillan.nmeyers.ShowFonts11 |
ShowFonts12 |
com.macmillan.nmeyers.ShowFonts12 |
DumpClass |
com.macmillan.nmeyers.DumpClass |
DumpClass11 |
com.macmillan.nmeyers.DumpClass11 |
JMakeDepend |
com.macmillan.nmeyers.JMakeDepend |
JMakeDepend11 |
com.macmillan.nmeyers.JMakeDepend11 |
FileStatus |
com.macmillan.nmeyers.FileStatus |
XClipboard |
com.macmillan.nmeyers.XClipboard |
FontPerf |
com.macmillan.nmeyers.FontPerf |
BackingStore |
com.macmillan.nmeyers.BackingStore |
PerfAnal |
com.macmillan.nmeyers.PerfAnal |
Profiler |
com.macmillan.nmeyers.Profiler |
The details of running these programs are provided in the section "How to Run the Programs".
For native software provided in the book, binary code usable in a glibc environment is included in the top-level glibc/ directory. If you need binaries for use in a libc5 environment (or any other Linux or UNIX environment), you will need to build them from source. All relevant source, plus a Makefile, is provided in the project source directories.
The following native components are provided on this CD-ROM:
Project |
Component Name |
Source Directory |
FileStatus |
libFileStatus.so |
|
XClipboard |
libXClipboard.so |
|
xwinwrap |
xwinwrap.so |
|
memstress |
memstress |
|
Profiler |
libProfiler.so |
To describe how to run these programs, we first define some environment variables for convenience:
JARFILE - The path to the JavaLinuxBook.jar file on this CD-ROM.
NATIVELIB - The path to the directory containing the shared libraries (glibc) on this CD-ROM. These libraries were built for use on glibc-based x386 Linux systems.
SWING - The path to the Swing 1.1 swingall.jar archive. This will only be used under JDK1.1.
COLLECTION - The path to the 1.1 Collections classes collections.jar archive. This will only be used under JDK1.1.
Here are some brief instructions for running the projects provided on the CD-ROM:
SlideShow (JDK1.2 only)Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.SlideShow [<width> <height>] For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.SlideShow 200 200 You must provide a list of images to be displayed (such as .gif and .jpg files) to stdin. |
WaterFall (JDK1.2 only)Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.WaterFall <font family> <style> <min_size> <max_size> <increment> For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.WaterFall serif plain 10 20 1 |
ShowFonts11Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts11 [<font families>] For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts11 java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts11 serif sansserif |
ShowFonts12 (JDK1.2 only)Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts12 [<font families>] For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts12 java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.ShowFonts12 serif sansserif |
DumpClass (JDK1.2 only)Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.DumpClass [-public] [-protected] [-package] [-private] [-suppress:{name,interfaces,hierarchy,headings,keys,all}] [-noancestors] [-inaccessible] <classes> For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.DumpClass java.lang.Object java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.DumpClass -suppress:keys,headings java.lang.Object |
DumpClass11 (JDK1.1 only)The JDK1.1 version has a dependency on the Sun Collections classes. Synopsis: java -classpath $CLASSPATH:$JARFILE:$COLLECTION com.macmillan.nmeyers.DumpClass11 [-public] [-protected] [-package] [-private] [-suppress:{name,interfaces,hierarchy,headings,keys,all}] [-noancestors] [-inaccessible] <classes> For example: java -classpath $CLASSPATH:$JARFILE:$COLLECTION com.macmillan.nmeyers.DumpClass11 java.lang.Object java -classpath $CLASSPATH:$JARFILE:$COLLECTION com.macmillan.nmeyers.DumpClass11 -suppress:keys,headings java.lang.Object |
JMakeDepend (JDK1.2 only)Note that the version of JMakeDepend on the CD-ROM has been enhanced since the version described in the book. You can read about the details in the README file. Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.JMakeDepend [-noinner] [-sourcepath <path>] [<class files>] For example (assuming class file names will be fed to stdin): java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.JMakeDepend -sourcepath src |
JMakeDepend11 (JDK1.1 only)Note that the version of JMakeDepend11 on the CD-ROM has been enhanced since the version described in the book. You can read about the details in the README file. JMakeDepend11 depends on the Sun Collections classes. Synopsis: java -classpath $CLASSPATH:$JARFILE:$COLLECTION com.macmillan.nmeyers.JMakeDepend11 [-noinner] [-sourcepath <path>] [<class files>] For example (assuming class file names will be fed to stdin): java -classpath $CLASSPATH:$JARFILE:$COLLECTION com.macmillan.nmeyers.JMakeDepend11 -sourcepath src |
FileStatusThe FileStatus project is intended primarily for use as a utility class. You can read the javadoc documentation to learn about the API. The class does include a simple main() method, allowing you to test the class. Synopsis: LD_LIBRARY_PATH=$NATIVELIB java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.FileStatus <files> For example: LD_LIBRARY_PATH=$NATIVELIB java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.FileStatus * |
XClipboardThe XClipboard project is intended primarily for use as a utility class. You can read the javadoc documentation to learn about the API. The class does include a simple main() method, allowing you to test the class. Synopsis: LD_LIBRARY_PATH=$NATIVELIB java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.XClipboard The result of running the test is to dump the contents of the X CLIPBOARD, PRIMARY, SECONDARY, and CutBuffer0 buffers. |
xwinwrapThe xwinwrap library must be pre-loaded when running an X application (such as Java AWT applications). For example: LD_PRELOAD=$NATIVELIB/xwinwrap.so java ... If you specify a visual, using the visual id values reported by the xdpyinfo utility, that visual will be used for the application: LD_PRELOAD=$NATIVELIB/xwinwrap.so XWINWRAP_VISUALID=0x22 java ... |
FontPerf (JDK1.2)Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.FontPerf [-nodoublebuffer] <fontname> <columns> <rows> <repetitions> For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.FontPerf serif-plain-12 60 30 10 java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.FontPerf -nodoublebuffer serif-plain-12 60 30 10 |
FontPerf (JDK1.1)The FontPerf program is usable under JDK1.1, but includes a dependency on the Swing classes. Synopsis: java -classpath $CLASSPATH:$JARFILE:$SWING com.macmillan.nmeyers.FontPerf [-nodoublebuffer] <fontname> <columns> <rows> <repetitions> For example: java -classpath $CLASSPATH:$JARFILE:$SWING com.macmillan.nmeyers.FontPerf serif-plain-12 60 30 10 java -classpath $CLASSPATH:$JARFILE:$SWING com.macmillan.nmeyers.FontPerf -nodoublebuffer serif-plain-12 60 30 10 |
memstressThis is just a native C program. Synopsis: $NATIVELIB/memstress <#bits of address space> <#repetitions> For example: $NATIVELIB/memstress 24 5 |
BackingStore (JDK1.2 only)You can read the javadoc documentation to learn about the API for the BackingStore class. The CD-ROM also provides the four versions of the Spiral program used to demonstrate the performance effectiveness of backing store. Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral0 <width> <height> java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral1 <width> <height> <count> <delay in ms> java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral2 <width> <height> <count> <delay in ms> java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral3 <width> <height> <count> <delay in ms> For example: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral1 300 300 100 100 java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral2 300 300 100 100 java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.Spiral3 300 300 100 100 |
PerfAnal (JDK1.2 only)To generate the data to be analyzed by PerfAnal, you need to run a Java application using the hprof profiler, as described in Chapter 60. After collecting the data, run PerfAnal. Synopsis: java -classpath $CLASSPATH:$JARFILE com.macmillan.nmeyers.PerfAnal [<tracefiles>] If tracefiles are not specified, PerfAnal reads tracefile data from stdin. |
Profiler (JDK1.2 only)The Profiler native shared library is loaded using the java launcher's -Xrun command-line option. Synopsis: LD_LIBRARY_PATH=$NATIVELIB java -green -XrunProfiler[:<options>] ... For example: LD_LIBRARY_PATH=$NATIVELIB java -green -XrunProfiler:file=profiledata.txt ... To see the available options: LD_LIBRARY_PATH=$NATIVELIB java -green -XrunProfiler:help |
The CD-ROM includes a distribution of the Inprise JBuilder3 Foundation integrated development environment. That distribution is not reproduced on this site, but the product can be obtained from Inprise at http://www.inprise.com/jbuilder/foundation/download/linux.html.