Tema: javax.comm
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/06/2007, 05:05
Rowan
 
Fecha de Ingreso: junio-2004
Mensajes: 33
Antigüedad: 19 años, 11 meses
Puntos: 0
javax.comm

Hola,
Os pongo en antecedentes.

Utilizo winXP y para programar jDeveloper.

Tengo que comunicar un puerto comm de mi pc con otro puerto comm del mismo pc. Lo que escribo en comm4 que lo lea comm5.

He bajado la api javacomm20-win32 y he segido las instrucciones de instalacion:

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

lo unico diferente es que yo le he metido en el jdk del jDeveloper. Despues en jDeveloper he agregado la libreria comm.jar a mi proyecto, y me deja hacer el import de la api sin problemas.

Pero al ejecutar el siguiente programa me da este error:

//el programa

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);
}
}
}


//El error

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.

Si alguien tiene alguna idea, todas son bien recibidas,

muchas gracias.

Rowan.