Thursday, May 27, 2010

gnu.io.PortInUseException

I spent some time today trying to figure out why I kept getting gnu.io.PortInUseException while opening a port. After closing more or less every program that could possibly infere with a usb/serial port I figured out that the exception was just badly named.

On Mac OS X one needs to create the directory (i used 777 rights on it)
   /var/lock
in order to be able to use RXTX at all. Else you just keep getting the damn gnu.io.PortInUseException.

I'm sure this is documented somewhere and I just didn't find it... but many thank to JGrass for the tip.

2 comments:

  1. Hi Mario,
    I checked out your rxtx-akka-io code at https://github.com/msiegenthaler/rxtx-akka-io and I found it very useful. I'm quite new with scala coding, I would like to ask you for some code snippets on how to use the akk-msj to manage the defined port operations like in example.scala file, that is how to messaging to the Example actor using the already defined cases
    1)case "close" =>
    2)case Received(data) =>
    3)case Closed =>
    Case 2) works fine when I send data from serial port, it prints out data sent from an arduino!, but not yet the others.
    how should I send a msj to the defined actor,
    val actor = system.actorOf(Props(new Example(port)), "e1")
    to stop, or write something?
    for closing the port I tryied sensing a Closed like
    actor ! Closed
    but without any result, port is still opend!
    Thanks in advance for any trick!
    Cheers,
    Rene


    ReplyDelete
  2. See https://github.com/msiegenthaler/rxtx-akka-io/issues/1 for my answer.

    ReplyDelete