无法使用 javax.comm api 找到端口
我正在尝试在一台机器上安装 javax.comm api(我已经安装在另一台机器上并且工作正常),但是当我运行示例“BlackBox”应用程序时,我收到一条消息“未找到串行端口!”。 我按照说明将win32com.dll放在jdk的bin目录下,comm.jar放在jdk的lib目录下,javax.comm.properties放在jdk的lib目录下。 我还将 comm.jar 文件添加到类路径中,因为我使用的是 jdk 而不是 jre。 所有这些,我仍然无法让 BlackBox 找到任何串行端口。 有人能帮我解决这个问题吗?
I am trying to install the javax.comm api on a machine (I already installed on another machine and it is working fine) but when I run the sample "BlackBox" application I get a message that says "No serial ports found!". I have followed the instructions and put win32com.dll in the bin directory of the jdk, comm.jar in the lib directory of the jdk, and javax.comm.properties in the lib directory of the jdk. I have also added the comm.jar file to the classpath since i am using a jdk and not jre. All this and I still can't get BlackBox to find any serial ports. Can anybody help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JDK 目录中有一个
jre
目录。 使用/jre/lib
,而不是/lib
。 另外,如果您已将位于其他位置的comm.jar
的另一个副本显式添加到您的类路径中,请将其取出。您可能需要在代码中添加 System.out.println(System.getProperty("java.home") 语句,以确保将内容放置在正确的目录中;即使您在运行
/bin/java
时,java.home
属性应为/jre
。There's a
jre
directory in your JDK directory. Use<jdk>/jre/lib
, not<jdk>/lib
. Also, if you've added another copy ofcomm.jar
, located elsewhere, explicitly to your classpath, take it out.You might want to add a
System.out.println(System.getProperty("java.home")
statement to your code to make sure that you are placing things in the right directory; even when you are running<jdk>/bin/java
, thejava.home
property should be<jdk>/jre
.它在我的 Windows XP(32 位)和 jdk1.6.0_21 上运行良好,如下所示:
1)设置环境变量:
2)安装三个文件:
3)从终端运行,如下所示:
It works fine on my Windows XP (32 bit) and jdk1.6.0_21 as follows:
1) Set the environment variables:
2) Install three files:
3) Run from terminal as follows: