gkrueger.com - Java

Overview

The Java source code on this site is mainly for educational purposes. It is not intended as production quality code. It has been written to resolve a few shortcomings of early Java versions. Most of the issues have been addressed in recent JDK versions, so the majority of the code on this site is no longer needed anymore. In one word, it's old stuff! Feel free to use it anyway, but don't expect too much.

Further information:

The java archiv file contains the following packages:

To shorten package names, I've choosen to start all package names with gk. instead of com.gkrueger. (which would be more appropriate in a world-wide environment). Maybe I'll change this in the future if there is a conflict with another author. To install the package, follow the rules below and be sure to read and accept the license agreement. All packages come with class files, source code and - sometimes - example files. The documentation is inlined in javadoc format, I do not provide separate documentation files currently.

Installation

To install the packages mentioned above, perform the following steps:

Using the classes in your own code

Once your CLASSPATH is properly set, the gk.* packages can be used like any other Java package installed on your system. For example, after importing gk.util.* the Str class is ready to be used in your program. Take a look at the following simple program which prints the numbers 1, 2, 4, 8, ... to the screen using the Str class:
import gk.util.*;

public class TestCounter
{
  public static void main(String args[])
  {
    for (int i = 1; i <= 1024; i *= 2) {
      System.out.println(Str.getFormatted("i = %4d", i));
    }
  }
}
Not surprisingly, the output is:
i =    1
i =    2
i =    4
i =    8
i =   16
i =   32
i =   64
i =  128
i =  256
i =  512
i = 1024

Using the classes in applets

To reduce download time for your applets, it makes sense to include all the required files for a particular applet (class files, sound files, images, and other supporting files) into a single jar archive (or, at least, a small number of archives). They may be included using the "archive" option of the APPLET tag. For further details refer to the jar Guide in the JDK documentation.

For best possible portability, it may make sense not to use jar files but instead include the .class files unchanged. Simply unpack the contents of the jar file to their appropriate directories and you're done.

Important note: Most of my Java code has been developed using an 1.1 version of the JDK (currently 1.1.6 under Windows 95). To view the applet examples, you therefore need an 1.1 capable browser (IE 4 or NS 4). Some of the application code has even been developed under 1.2Beta4 and 1.2 (aka Java 2).

Using the source code

You're allowed to use the source code of the packages as long as you're conforming to the rules mentioned below. If you want to modify and/or enhance the source, include the appropriate copyright and header information for both original and changed code. To successfully change and compile the code, be sure to put the files in the appropriate directory as implied by the package name and set your CLASSPATH accordingly. All the source files are in their respective subdirectories after unpacking the gkjava.zip file.

Disclaimer

You're allowed to use this code as long as you're conforming to the rules mentioned below. Be sure to understand that all code has been written for non-professional use and should not be considered of industrial-strength quality. Some should even be considered of experimental nature.

Copyright (c) 1997-2003 Guido Krueger. All Rights Reserved.

Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies.

THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.


© 1995 Guido Krüger - Last updated 31 Dec 2003 - Back to top-level page