Java Communications API, help to start!

From: Dmitry (dmkovtun_at_jyu.fi)
Date: 02/10/04


Date: 10 Feb 2004 01:17:45 -0800

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.



Relevant Pages

  • Re: Com port Communication
    ... static CommPortIdentifier portId; ... Method declaration ... If your ports are listed then you've installed it correctly. ...
    (comp.lang.java.programmer)
  • Re: Multiple Undetermined Number of Variables
    ... I"m betting that you are NOT allocating the individual SerialPort instances. ... foreach (string portName in SerialPort.GetPortNames()) ... Uniquely and simultaneously use these ports: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Multiple Undetermined Number of Variables
    ... number of SerialPort instances that correspond to the number of ports on the ... SerialPort> using the name of the serial port as a key. ... so my code needs to be dynamic with this ... because I want to monitor ALL COM ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RFID with PIC (PIC16F876)
    ... My laptop has no COM ports. ... My latest cheapy desktop has 2 serial ports and 4 USB ports ... yes, most desktops still have a serialport, but.. ...
    (sci.electronics.design)