Java/Comunicazione seriale: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
FrescoBot (discussione | contributi)
m Bot: errori di battitura
Riga 46:
 
==== Webstart ====
JavaComm ===== JavaComm =====
AUn generalproblema problemgenerale, both forsia per''JavaComm'' and e''RxTx'' isè, thatche theysi resistoppongono installationall'installazione via [http://java.sun.com/products/javawebstart/ Java WebStart]:
 
JavaComm''JavaComm''è is notoriousnoto, becauseperché itrichiede requires aun file called chiamato''javax.comm.properties''per toessere beinserito placednella indirectory thelib JDK, libqualcosa directory,che somethingnon which can'tsi bepuò donefare withcon Java WebStart. ThisCiò isè particularlyparticolarmente sadtriste, becauseperché theil needbisogno fordi thatquel file isè theil resultrisultato ofdi someuna unnecessaryprogettazione design/decisioninutili in/ decisione''JavaComm''e andavrebbe couldpotuto havefacilmente easilyessere beenevitata avoided by themediante la''JavaComm'' designersdesigner. Sun constantlyrifiuta refusescostantemente toper correctcorreggere thisquesto errorerrore, citingcitando theil mechanismmeccanismo isè essentialessenziale. WhichChe isè, theysono aresdraiato lyingcon throughi theirdenti teethquando whensi it comes totratta di''JavaComm'', particularsoprattutto, becauseperché Java forper alungo longtempo timeha hasuna aarchitettura service provider architectureesattamente exactlydestinati intended fora suchtali purposesscopi.
 
TheIl contentscontenuto of the propertiesdel file isdi typicallyproprietà justè onein line,genere theuna namesola ofriga, theil javanome classdella withclasse theJava nativecon il driver nativo, e.g.ad esempio:
 
<source lang=java> driver = com.sun.comm.Win32Driver </ source>
 
TheIl followingseguente isè aun hack whichche allowspermette todi deploydistribuire JavaComm via Web Start ignoringignorando thatche brain-deadil propertiescervello di proprietà morti file. ItSi hasè seriousgravi drawbacksinconvenienti, ande mightpotrebbe failnon withriuscire newercon JavaCommle releasesnuove -uscite shouldJavaComm - Sun everdovrebbe mai comevenire aroundintorno ande makefare auna newnuova versionversione.
 
FirstIn primo luogo, turndisattivare offil thegestore securitydella managersicurezza. SomeAlcuni doofusprogrammatori programmerDoofus ata Sun decidedha thatdeciso itche wouldsarebbe bebello coolnuovo toe againdi andnuovo againper checkverificare for thel'esistenza existence of the dreadeddel temuto''javax.comm.properties'' file, evenanche afterdopo itche hasè beenstato loadedcaricato initiallyinizialmente, forper nonessun otheraltro apparentmotivo apparente, reasonrispetto thanal checkingcontrollo forper thela file.
 
<source lang=java> System.setSecurityManager (null); </ source>
 
ThenPoi, whenquando initializingsi the JavaComminizializza l'API JavaComm, initializeinizializzare theil driver manuallymanualmente:
 
<source lang=java> String driverName String = "com.sun.comm.Win32Driver"; / / oro getottenere ascome auna JNLPproprietà propertyJNLP
 CommDriver commDriverCommDriver = (CommDriver) Class.forName (driverName).newInstance NewInstance ();
 commDriver.initialize ();</ source>
 
===== RxTx =====