日期:2014-05-20  浏览次数:20948 次

求助,关于java打开串口错误的问题
我先装的jre-6-windows-i586.exe
然后jre-6-windows-i586.exe

然后下载的javacomm20-win32.zip

按照他的安装文档设置环境变量等。

Copy win32com.dll to your <JDK>\bin directory. 



Copy comm.jar to your <JDK>\lib directory. 


Copy javax.comm.properties to your <JDK>\lib directory. 


Add comm.jar to your classpath  


/*错误在这里。。。。。。。。。。。。
Several serial port sample applications are provided with this release. One of them is BlackBox. To run BlackBox, first add BlackBox.jar to your classpath: 

C:\>set CLASSPATH=c:\commapi\samples\Blackbox\BlackBox.jar;%CLASSPATH% 

Now you can run BlackBox: 

C:\>java BlackBox 

当运行完之后。
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/CommPort

请问怎么回事。。。


------解决方案--------------------
试试copy一份至 jdk\jre\lib,
classpath指向的因是jre对应目录.