javax.comm:Error instantiating class com.sun.comm.Win32Driver
I use winXP and JDeveloper as IDE
I have to communicate comm port from my computer with other port comm from the same computer.
The thing that I write with comm4, it has to be read by comm5.
I've downloaded javacomm20-win32 api and I've followed the instructions:
1.- C:\>copy c:\commapi\win32com.dll to c:\jdk1.1.6\bin
2.- C:\>copy c:\commapi\comm.jar c:\jdk1.1.6\lib
3.- C:\>copy c:\commapi\javax.comm.properties c:\jdk1.1.6\lib
4.- C:\>set CLASSPATH=c:\jdk1.1.6\lib\comm.jar
When I execute this program:
Code:
package Olentzero;
import java.util.Enumeration;
import javax.comm.CommPortIdentifier;
public class CoMBilaketa {
public static void main(String args[]) {
Enumeration ports =
CommPortIdentifier.getPortIdentifiers();
while (ports.hasMoreElements()) {
CommPortIdentifier port =
(CommPortIdentifier)ports.nextElement();
String type;
switch (port.getPortType()) {
case CommPortIdentifier.PORT_PARALLEL:
type = "Parallel";
break;
case CommPortIdentifier.PORT_SERIAL:
type = "Serial";
break;
default: /// Shouldn't happen
type = "Unknown";
break;
}
System.out.println(port.getName() + ": " + type);
}
}
}
this error appears:
Code:
java.io.IOException: Error instantiating class com.sun.comm.Win32Driver
com.sun.comm.Win32Driver
at javax.comm.CommPortIdentifier.loadDriver(CommPortI dentifier.java:239)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIde ntifier.java:109)
at Olentzero.CoMBilaketa.main(CoMBilaketa.java:10)
Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive
at com.sun.comm.SunrayInfo.isSessionActive(Native Method)
at com.sun.comm.Portmapping.registerCommPorts(Portmap ping.java:155)
at com.sun.comm.Portmapping.refreshPortDatabase(Portm apping.java:100)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIde ntifier.java:138)
at Olentzero.CoMBilaketa.main(CoMBilaketa.java:10)
Process exited with exit code 1.
any ideas?
any suggest?
You need to put all these files in JRE's directories...then only it will work...i tri
You need to put all these files in JRE's directories...then only it will work...i tried ur sample it worked.