Appendix C Obtaining The Code Samples
Overview
All of the code samples shown in the listings in this book are available on the accompanying CD-ROM. To get them, insert the CD and copy the entire "Java For RPG Programmers" folder to a local disk drive.
Within the Java For RPG Programmers folder there is a samples folder, and within that there is a subfolder for each chapter and appendix in the book. Within each chapter folder is a folder per listing from the book, containing the source files for that listing. Where appropriate, there is enough source per such folder to allow for a full compile and run. To do this, you will need to download and install the Java 2 Platform, Standard Edition SDK from the Sun Web site www.java.sun.com/products.
The CD-ROM also contains a full Java development environment, for your convenience. This is the Eclipse product, release 1.0, which is also available at on the Web. Eclipse is an open-source project from IBM, for building software around an Integrated Development Environment. It includes Java tooling as part of its base offering. You will enjoy exploring the power of Eclipse, and eventually you may decide to even write your own tools within Eclipse. These are written in Java, and are called plugins. There is built-in support in Eclipse for writing plugins for Eclipse. If you use Eclipse, you do not need to download a Java SDK. Eclipse only needs a Java Runtime Environment, and one is supplied for one on the CD-ROM and will automatically be used by Eclipse. However, you may still wish to download the SDK documentation.
To see, edit and run the book samples within Eclipse, first start Eclipse by double clicking on the eclipse.exe executable file in the Eclipse1.0 folder. Note that it cannot be run from the CD, only from a writable local disk. Once Eclipse is up, you can import the book samples by using the File menu and selecting the Import option. The import option will create one Java project per chapter. To work with the samples for a given chapter, simply expand the chapter and drill down to the source files. Double click to open a source file. If this file is a Java file with a main method, you can run it by selecting the file and then the Run action from the toolbar (the running man icon). As you save your edit changes with Ctrl+S, Eclipse automatically compiles for you. There is also a very nice feature in the Java editor for finding members. After typing an object name and a dot, you can press Ctrl+Space to get a list of members within that object.
This version of Eclipse is the same version that is the basis of the first release of the IBM products WebSphere Studio Application Developer, WebSphere Studio Site Developer and WebSphere Development Studio Client. If you have any of these products, you can copy the com.j4r plugins folder to the plugins folder within these products. Once copied, you will see the the Java For RPG Programmers Samples import option when you next start the product. Please note however, this may not work on subsequent releases of these products, as they step up to future releases of Eclipse.
Also on the CD-ROM, for your convenience, is the AS/400 Toolbox for Java. The documentation is in the Toolbox folder, while the Jar files are in the Eclipse subfolder pluginscom.j4r untime. These are ready to use within Eclipse for the imported chapter projects. To use them in your own projects, create variable entries to the Jar files. Do this by selecting the project, right-clicking, selecting Properties, then the Java Build Path entry. Go the Libraries tab, and press Add variable. Enter ECLIPSE_HOME for the variable name, and use the Browse button to find the jt400.jar file in the runtime folder.