重金求解:applet访问串口的问题,无法找到Win32Driver
applet访问串口步骤:1.配置环境,把Sun程序的comm.jar包,win32com.dll,javax.comm.properties放到相应的目录中
2.编写applet程序,并生成class文件
3.把applet程序的class打成jar包
4.生成数字签名文件
5.用数字签名给jar包签名
6.编写页面html代码
7.编写安全策略文件(给allpermission权限)
8.测试代码(用appletviewer 应用策略文件)
请教大虾: 上面步骤是否正确?我目前照上面步骤做,在第8步时,报Caught java.lang.NullPointerException: name can't be null while loading driver com.sun.comm.Win32Driver错误。查看我的源码,出现在51行:
51: Enumeration commportEnum=tmpCommportIdent.getPortIdentifiers();
52: while (commportEnum.hasMoreElements())
53: {
54: tmpCommportIdent=(CommPortIdentifier)commportEnum.nextElement();
55: if ((tmpCommportIdent.getName().trim().toUpperCase().equals
56: (this.commPortName)) && (tmpCommportIdent.getPortType()
57: ==CommPortIdentifier.PORT_SERIAL))
58: {
59: foundPortFlag=true;
60: break;
61: }
62: }
熟悉串口编程的朋友肯定知道这一段是找机器中串口的代码例如(COM3),这代码按理说是不会出这种错的。我就搞不明白了,请教各位,谁能帮我找到原因?