Tips & Techniques - Java - April 1996

From EDM2
Revision as of 13:32, 4 April 2016 by Ak120 (Talk | contribs)

Jump to: navigation, search

By IBM


Tip: On an OS/2 command line, Java programs should be started with the "java" executable; Java programs that use AWT windows should be started with the "javapm" executable.

Tip: View Java ouput written to standard out and standard error by piping both stdout and stderr to a file.

Tip: Make sure that you install the JDK 1.0 for OS/2 on an HPFS partition; we're working to make the runtime FAT compatible.

Tip: View Java applets under the JDK 1.0 for OS/2 using the "applet" executable, rather than "appletviewer" as on some other platforms.

The applet viewer automatically redirects stdout and stderr output to a weblog file in the x:\javaos2\weblogs directory

Tip: Run several applets simultaneously without receiving an error from the "appletviewer."

Technique: Imbed several applets in a single HTML document, using the applet tag, and open that document using "applet 'http://path/document.html'", you should see multiple applet viewer windows open. All should run fine.

Tip: Use environment variables to modify the behaviour of the Java runtime.

Technique: Set environment variables as follows:

JAVA_CONNECT_TIMEOUT=n will adjust the time that Java will wait for a network connection before reporting a timeout. 'n' is in seconds, from 1 through to a million (default = 30).

JAVA_AUDIO_VOLUME=v will adjust the volume that Java will use for audio output and is a percentage of the maximum volume. 'v' may take a value from 0 to 100 (default=75).

JAVA_AUDIO_RATE=n will set the preferred playback sample rate for audio. A value for 'n' of 8 will replay at 8000 per second, or 11 for 11025 samples per second. The Java runtime will normally try 8000 first (to match the incoming data stream) and then 11025; some drivers (notably some ThinkPad 701C early drivers prior to October 1995) appear to support 8000 but then fail; they can be made to work by forcing the playback rate to 11025.

JAVA_HOME=<dir> will set the path to the shared Java runtime directories.

JAVA_USER=<dir> will set the path to the directory into which and from which user specific files will be accessed, eg .hotjava\properties file.

JAVA_WEBLOGS=<dir> will set the path to the directory into which the Java runtime will write weblog files for each started Java process.

Tip: Set up your standalone machine to do local testing of your Java application.

Technique: Perform the following:

1. Install either the Internet Access Kit from the OS/2 Warp BonusPack or TCP/IP 3.0 from OS/2 Warp Connect.

2. Specify SET USE_HOSTS_FIRST=1 in your CONFIG.SYS file.

3. Create a file called "hosts" in your \ETC directory. The easiest way to do this is to " E %ETC%\hosts". In this file, place the following line:

127.0.0.1 here (where 127.0.0.1 here is the hostname)

4. After TCPSTART.CMD has executed, execute the following command:

ifconfig lo 127.0.0.1

Note: This establishes a "loopback" device that will allow your machine to talk to itself. If you install TCP/IP 3.0, the parallel port NDIS driver that it installs also loops back if you don't have a laplink cable installed.

5. Test using 127.0.0.1 as the IP address or whatever host name you specified in the "hosts" file.


Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation