Hello,
My goal is to use Java through PHP to open and read a serial on a local machine.
So, my first step was to open the port and I used the method :
CommPortIdentifier.getPortIdentifier("COM1") to catch the port.
This method raises an exception that has to be caught.
I encapsulate this access in the class JavaSerialPort so it can be accessed from PHP. Here the Java code
public class JavaSerialPort{
public JavaSerialPort(){
}
public int openPort(){
try{
CommPortIdentifier p = CommportIdentifier.getPortIdentifier("COM1");
}
catch(NoSuchPortException nsp){
return 1;
}
return 0;
}
}
This code is ok when it's called from Java.
When I call this from PHP , the exception is raised.
Config :
- Win2000pro
- Apache 1.3.19
- PHP 4.0.4
- JDK 1.4.0
Thanks a lot for your help...