Java/Comunicazione seriale: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
fix (modifico a sezioni
sintassi colorata→‎JavaComm
Riga 53:
The contents of the properties file is typically just one line, the name of the java class with the native driver, e.g.:
 
<source lang=java> driver=com.sun.comm.Win32Driver</source>
 
The following is a hack which allows to deploy JavaComm via Web Start ignoring that brain-dead properties file. It has serious drawbacks, and might fail with newer JavaComm releases - should Sun ever come around and make a new version.
Riga 59:
First, turn off the security manager. Some doofus programmer at Sun decided that it would be cool to again and again check for the existence of the dreaded ''javax.comm.properties'' file, even after it has been loaded initially, for no other apparent reason than checking for the file.
 
<source lang=java> System.setSecurityManager(null);</source>
 
Then, when initializing the JavaComm API, initialize the driver manually:
 
<source lang=java> String driverName = "com.sun.comm.Win32Driver"; // or get as a JNLP property
CommDriver commDriver = (CommDriver)Class.forName(driverName).newInstance();
commDriver.initialize();</source>
 
===== RxTx =====