Java and TextPad configuration

Java JDK installation

Many computers already have a Java runtime version (JRE) installed. You also need to install the JDK - Java Development Kit (previously known as the SDK - System Development Kit). The JDK download contains the same things as the JRE download plus additional tools for development. If the JRE is not installed or is not a current version, it can be installed as part of the JDK installation process.

Java's Feature releases are numbered 1.4, 1.5, ...
There will also be Update releases 1.5.0_01 and Maintenance releases 1.5.1

Install Java to a folder using only the Feature release number. This will require selecting the Custom install option and Changing the suggested folder during the install process.

When future releases occur, they can be installed in the original Feature release folder -- this will greatly simplify your system maintenance.

It is OK to have multiple versions of Java installed but you do not need anything more than the current JRE and JDK. Java is not like Microsoft with its DLL hell. Later versions of Java will always run class files compiled in an earlier version without any trouble. You can even compile Java programs to run in an earlier version.

Java configuration check

System can find Java but Java cannot find your .java or .class files

Depending on the history of Java packages installed on your PC, Windows may be using a CLASSPATH environment variable which tells Java where to look for .java and .class files.

Fix the CLASSPATH Option 1 (preferred if a classpath exists)

Fix Option 2 (overrides existing classpath environment variable)

TextPad cannot find java.exe or javac.exe

From TextPad help:
To be able to use Java with TextPad, the Java JDK must be installed using its setup program. This writes information to the registry, which TextPad cannot work without.

Unfortunately, it seems the current setup program may not do this. See this page to fix the registry.

Create Java Documentation from within TextPad

TextPad comes configured to compile and run Java applications and applets. See the Tools menu. You can customize TextPad to run a batch file which creates Java documentation.

The runJavaDoc.bat file can be found in the first three week's download sample files. It creates Java documentation for you in a separate subdirectory. You may want to add the "-private" switch to the javadoc command in the batch file to force javadoc to document not only the public interfaces to your code but also your private variables and methods.

Now, under the Tools menu, you should see your javadoc item which you can run at any time in addition to compiling and running your Java applications.

.jar files

A Java .jar file is a single file that contains a package of classes (usually many .class files within a directory structure).

In the beginning of the course, you may wish to use the Seneca bobjects (business objects) package to do GUI programming without the gooey programming. DOWNLOAD the package, documentation, and instructions.

Later in the course, we will use a jar file containing the AS/400 Toolkit for Java that allows us to access iSeries databases and functions.

Usually, Java .jar files containing classes your programs use should be placed in the Java "extensions" directory (folder) which is usually the \jre\lib\ext subfolder of the Java installation directory. e.g.
C:\Program Files\Java\jdk1.5\jre\lib\ext

Find out which ext directory your Java installation is using by running the Welcome2.java program from Week 1, ShowJavaProperties from Week01GUI.zip or run

System.getProperty( "java.ext.dirs" );