To test the Port Information application:
Download the JCA, which is available in a zip format with the name Javacomm20-win32.zip. The JCA can be downloaded from the following URL: http://java.sun.com/products/javacomm/downloads/index.html
Unzip the zip file downloaded from the above URL.
Copy the win32com.dll from the unzipped file to jre\bin directory where the J2SDK is installed.
Copy the comm.jar from the unzipped file to the jre\lib\ext directory where the J2SDK is installed.
Copy the javax.comm.properties from the unzipped file to the jre\lib directory where the J2SDK is installed.
Set the path of the bin directory of J2SDK by executing the following command at the command prompt:
set path = %path%;D:\j2sdk1.4.0_02\bin;
Set the classpath of the lib directory of J2SDK by executing the following command at the command prompt:
set classpath = %classpath%;d:\j2sdk1.4.0_02\lib; d:\j2sdk1.4.0_02\jre\lib\ext\comm.jar;
Copy the PortDescription.java and ShowDescriptionWindow.java files to a folder on your computer. On the command prompt, use the cd command to move to that folder where you have copied the Java files. Next, compile the files using the javac command as follows:
javac *.java
To run the Port Information application, specify the following command at the command prompt:
java PortDescription
Click the List Serial Ports button on the Port Information application window to list all the serial ports attached to a computer. The Serial Ports list box displays the serial ports, as shown in Figure 2-3:
Figure 2-3: Displaying the List of Serial Ports
Click the List Parallel Ports button to list the parallel ports attached to a computer. The Parallel Ports list box displays a list of parallel ports, as shown in Figure 2-4:
Figure 2-4: Displaying the List of Parallel Ports
Select a port from the list of ports and click the Port Description button. The description of the selected port appears, as shown in Figure 2-5:
Figure 2-5: Displaying the Port Description
Click the OK button to close the Port Description window.
Select a port from the list of ports and click the Open Port button. The selected port opens and a confirmation message appears, as shown in Figure 2-6:
Figure 2-6: The Open Port Window
Click the Yes button to close the port. If you clicked the No button and again try to open the same port. The error message appears, as shown in Figure 2-7:
Figure 2-7: An Error Message