beyerss
beyerss

Reputation: 1352

Can't find ports with javax.comm api

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?

Upvotes: 1

Views: 4738

Answers (2)

nick
nick

Reputation: 51

It works fine on my Windows XP (32 bit) and jdk1.6.0_21 as follows:

1) Set the environment variables:

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21
Path=...;C:\Program Files\Java\jdk1.6.0_21\bin;

2) Install three files:

C:\Program Files\Java\jre6\lib\comm.jar
C:\Program Files\Java\jre6\lib\javax.comm.properties
C:\Program Files\Java\jre6\bin\win32com.dll

3) Run from terminal as follows:

cd commapi\samples

java -classpath "C:\Program Files\Java\jre6\lib\comm.jar";BlackBox\BlackBox.jar BlackBox

Upvotes: 0

erickson
erickson

Reputation: 269797

There's a jre directory in your JDK directory. Use <jdk>/jre/lib, not <jdk>/lib. Also, if you've added another copy of comm.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, the java.home property should be <jdk>/jre.

Upvotes: 1

Related Questions