问题
I am trying to get GPS data from a NMEA 0183 GPS via the Java Marine API, using the RXTX API.
Running the Java Marine supplied SerialPortExample.java, I return the two errors. Perhaps they are related and so I am bundling them together into this question.
gnu.io.PortInUseException: Unknown Application
I believe this is caused by the RXTX API. A search reveals that OSX often is missing the required var/lock folder, which one would rectify by with sudo mkdir /var/lock
(full details: https://groups.google.com/forum/#!topic/openhab/YUJC8DTLokc) however this does not solve my problem.
WARNING: RXTX Version mismatch
I have Jar RXTX-2.1-7
but native lib Version = RXTX-2.2pre2
. I am trying to download the latest version of RXTX, but keep running into dead links (http://rxtx.qbang.org)
I am running Mavericks on MB Air.
Can anyone help?
回答1:
Problem 1
gnu.io.PortInUseException: Unknown Application
I solved this by looking up the ports in use on my machine with ls /dev/tty.*
This flagged up a lot of old bluetooth devices, I cleared most of them off (Apple > System Preferences > Bluetooth) and it solved the problem
Problem 2
WARNING: RXTX Version mismatch
I took some time to delete everything associated with the RXTX install, and ensured that I was only using one version. Seems to have done the trick.
回答2:
unknown port exception
This error happens while some of other programs are using the serial port .Make sure your no other applications are using serial port when your application works .check your application is also running only single copy.
RXTX version mismatch
download rxtx jar matched with your java version
回答3:
I had the same bug. Make sure you terminate any other processes that could be using that connection. I was trying to run my program from the command line but the port was connected to energia's serial monitor.
RXTX: if you manually added any RXTX files delete them and run sudo apt-get install librxtx-java, this should clear up the mismatch.
来源:https://stackoverflow.com/questions/21441295/rxtx-gnu-io-portinuseexception-warning-rxtx-version-mismatch