Java Communications API, help to start!

D

Dmitry

Dear friends!

I have problem with Java Communications API. I try to run simple
program to get list of serial ports.
Here is my checklist what I do:

1. have downloaded Java Communications API version 2.0 for Microsoft
Windows
2. placed comm.jar and javax.comm.properties into c:\sdk1.4.2_03\ lib
3. placed win32com.dll into c:\sdk1.4.2_03\ bin
4. setup classpath variable for c:\sdk1.4.2_03\lib\comm.jar
5. turn on my node device that is connected to PC by COM port
6. made simple program and run it:

import java.io.*;
import java.util.*;
import javax.comm.*;

public class proba implements SerialPortEventListener{
static CommPortIdentifier portId;
static Enumeration portList;
SerialPort serialPort;
public static void main(String args[]){
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.println(portId.getName());
}
}
public void serialEvent(SerialPortEvent event) {
}
}

7. expect the list of ports, but there is no one. Actually portList
has no elements at all.
8. my OS is Win2000 and I have only entry in javax.comm.properties
file Driver=com.sun.comm.Win32Driver

So give an advice please how to fix this problem. Actually I have some
questions
is Java Communications API version 2.0 is developed for win2000?
is win32com.dll driver is enough?
is entry “Driver=com.sun.comm.Win32Driver” in
javax.comm.properties file correct?

Thank you for any help.
 
D

Damian P.

Hi,

1. win32com.dll put to c:\sdk1.4.2_03\jre\bin
2. javax.comm.properties put to c:\sdk1.4.2_03\jre\lib
3. comm.jar put to c:\sdk1.4.2_03\jre\lib\ext

Regards
Damian
 
D

Dale King

Damian P. said:
Hi,

1. win32com.dll put to c:\sdk1.4.2_03\jre\bin
2. javax.comm.properties put to c:\sdk1.4.2_03\jre\lib
3. comm.jar put to c:\sdk1.4.2_03\jre\lib\ext


And probably you need to also put them in the same places under C:\Program
Files\Java\j2re1.4.2_03, because most likely that is the JRE you are using
for running the code. The JRE in the SDK directory is the one you used for
compiling it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top