The Java SerialPort class provides access to the serial ports of the computer allowing you to communicate with barcode readers, modems, mice, printers, sensors, or any serial device.
Demonstration Targets
SerialConfig.class
Is a scaled down version of the serial port configuration interface
class.
JavaTermDemo.class
Is a simple console terminal application allowing you to send keystrokes
to the serial port and reporting bytes received from the serial port.
Settings.class
Is a scaled down version of the file that comes with the SerialPort
product. The demo version only allows selection of the port number.
JTermDemoRcvTask.class
This is the thread that receives characters from the port and displays
them in the receive box.
Windows95
WindowsNT x86
Win95 Copy the DLL(s) to the Windows\System directory.
WinNT Copy the DLL(s) to the Winnt\System32 directory.
Put the shared library in a directory and export the directory name
in the LD_LIBRARY_PATH environment variable.
For example you could create a script as shown below. Be sure to use
the shared library name for your platform. On Linux it should look
like similar to this:
#! bin/sh
ln -s libjspLuxDemo.so.1.0 libjspLuxDemo.so.1
ln -s libjspLuxDemo.so.1 libjspLuxDemo.so
LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH
You may have to modify this depending on your flavor of Unix. For example AIX 4.2 requires LIBPATH in place of LD_LIBRARY_PATH.
Put the shared library into the extensions folder
and reboot the computer.
The demo class files are in JTermDemoClasss11.zip. These were compiled with the JDK 1.1.3. Note that the SerialPort classes will work on either Java 1.0.2 or Java 1.1, however the demo uses the AWT, and the new event delegation model used by the AWT in Java1.1 is not 100% compatible with 1.0.2. We have provided a set of classes especially for use with the JDK1.0.2 if you are using an older VM. These classes can be found in the file JTermDemoClass102.zip.
Windows
To run the demo with Café, Visual Café, or a Sun JDK,
enter the command java JavaTermDemo comName for example
to use with COM3 enter java JavaTermDemo COM3.
To run the demo with J++ or a MS-JDK enter the command jview JavaTermDemocomName
To run the demo with JDK 1.0.2 use only the COM number, e.g. java JavaTermDemo 3
Note: Microsoft's jview does not correctly report an unsatisfied link error if it cannot find a DLL. If you start JavaTermDemo and you do not see the JavaTerm GUI window the most likely cause is the MS JVM cannot find the DLL(s). There is also an apparent bug with MS JDK 1.0 where it requires the entry DLL to be in the current directory. If you have MS JDK1.0 the best way to run this demo is to put all the DLLs in the current directory.
OS/2
For OS/2 use the command javapm JavaTermDemo devName,
or java JavaTermDemo devName.
When the java JavaTermDemo form of the command is used, output from System.out will show up in the original command line window. If a specific Java console is desired, set the environment variable JAVA_CONSOLE=1 before running javapm.
If you want to use the "Run Java Program" or "Run Java PM Program" icons in the "Java for OS/2" folder, there are two requirements. First place the required class files in a directory specified by CLASSPATH, then place the DLLs in a directory (other than ".") specified by LIBPATH. Following these configurations, when the icon is double clicked, it will prompt for a parameter which should be entered as JavaTermDemo.
IBM JDK 1.1.4 bug
The IBM JDK 1.1.4 has a bug that causes the VM to report it is running
on Window 95 even when running on OS/2. This version of the VM will not
work with the SerialPort demo.
Macintosh
To run the demo with the Metrowerks VM, double-click on the file
JavaTermDemo.zip
Linux x86
FreeBSD x86
Solaris x86
Solaris Sparc
HP/UX PA-RISC
SGI Irix Mips
AIX PPC
To run the demo with the Sun JDK, enter the command java JavaTermDemo devName where devName is the name of the serial device e.g. /dev/ttyR0.
SGI Irix Mips Note
To run the demo with some versions of IRIX and the SGI JDK , you may
need to involke the MIPS ABI options. For example with SGI JDK 1.1.6 on
IRIX 6.4 use the MIPS o32 ABI by entering the command java
-32 JavaTermDemo devName where devName is the name of the serial
device e.g. /dev/ttyd2/.
Get your Java serial port project moving ahead full steam...purchase SerialPort today!
Contact US
If you have questions or comments please contact us.
Solutions Consulting,
Santa Barbara, CA
sales@sc-systems.com
805-964-4868