请到sun的网站下载javacomm20-win32.zip文件, 参考里面的配置文档"jdk1.2.html"(在commapi目录下面)以下是jdk1.2.html文件的部份内容:Installing the Java Communications API on JDK 1.2 (RC1) <jdk> refers to the root directory of your JDK installation. If you installed JDK in c:\jdk1.2 then replace all reference to <jdk> with c:\jdk1.2. 1. Windows: place the win32com.dll in <jdk>\jre\bin directory. Solaris: put the libSolarisSerialParallel.so in the LD_LIBRARY_PATH. 2. Place the comm.jar in <jdk>\jre\lib\ext. 3. Place the javax.comm.properties in <jdk>\jre\lib . 4. Do not alter the CLASSPATH.================== 另外:CommPortIdentifier.getPortIdentifiers();不大可能返回NULL, 这里是CommPortIdentifier.java文件的部份源代码: ...... public static Enumeration getPortIdentifiers() { SecurityManager securitymanager = System.getSecurityManager(); if(securitymanager != null) securitymanager.checkDelete(propfilename); return new CommPortEnumerator(); } ......CommPortEnumerator类实现了Enumeration接口
可以这样使用吗!
参考里面的配置文档"jdk1.2.html"(在commapi目录下面)以下是jdk1.2.html文件的部份内容:Installing the Java Communications API on JDK 1.2 (RC1)
<jdk> refers to the root directory of your JDK installation. If you installed JDK in c:\jdk1.2 then replace all reference to <jdk> with c:\jdk1.2. 1.
Windows: place the win32com.dll in <jdk>\jre\bin directory. Solaris: put the libSolarisSerialParallel.so in the LD_LIBRARY_PATH. 2.
Place the comm.jar in <jdk>\jre\lib\ext. 3.
Place the javax.comm.properties in <jdk>\jre\lib . 4.
Do not alter the CLASSPATH.==================
另外:CommPortIdentifier.getPortIdentifiers();不大可能返回NULL,
这里是CommPortIdentifier.java文件的部份源代码:
......
public static Enumeration getPortIdentifiers()
{
SecurityManager securitymanager = System.getSecurityManager();
if(securitymanager != null)
securitymanager.checkDelete(propfilename);
return new CommPortEnumerator();
}
......CommPortEnumerator类实现了Enumeration接口