Under Netbeans 5.5 on Windows, I needed to right-click Libraries under Projects on the left hand side of the screen, and select "Add JAR/Folder", picking the RXTXcomm.jar file. Only then did my
enter code here
become a valid command. Also, I got a run-time error where it failed to load the rxtxSerial.DLL library because it couldn't find it. I needed to right-click the project name, select properties, select Run under categories, and add a VM Options: entry of
-Djava .library.path =「C:\其中,不斷你-卡住rxtxSerial.DLL文件;%PATH%
Example:
-Djava.library.path="C:\rxtx-2.1-7-bins-r2\Windows\i368-mingw32\;%PATH%"
While I'm sure there is more than one way of adding the directory to your path, this worked for me. Note I did the default NetBeans 5.5/JDK 1.6.0 isntall accepting all the default options(ie clicking next until I got to finish), so I haven't modified my java paths or anything. Alternatively you can copy the *.dll into C:\Windows\System32\, Java will find it there automatically.
需要注意的是運行64位JRE時,你不能使用32位的DLL: 您將得到類似的錯誤:
Can't load IA 32-bit .dll on a AMD 64-bit platform thrown while loading gnu.io.RXTXCommDriver
To solve this simply install the 32bit JDK and add a new Platform in Netbeans under Tools->Java Platforms->Add Platform and change the project settings to use the newly created platform. make sure you type
"import gnu.io.*"
從http://rxtx.qbang.org/wiki/index.php/Using_RXTX_In_NetBeans
我已閱讀,以及和我都放置在正確的地方的dll文件和罐子和過程監控表明JVM看到他們。這就是我困惑的原因。 – sldahlin
這有助於我在Ubuntu 12.10上設置Eclipse。謝謝。 – Kasisnu