• Post Reply Bookmark Topic Watch Topic
  • New Topic

javacomm serial port created after JVM started  RSS feed

Jeff Fern
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am playing with bluetooth and Java for a project and have run into a brick wall.

My bluetooth adaptor (USB) uses rfcomm to create a virtual serial port to my phone.

After exhaustive searching, I have not been able to find a Java API for a usb bluetooth dongle that will do this so I am having to use Runtime.exec to shell the program that will create the connection.

The device that is created is /dev/rfcomm0, and I have created a symlink from /dev/ttyS1 to this so JavaComm can see this as /dev/rfcomm0 is not considered valid (I only have one com port in my PC so ttyS1 does not normally exist).

When Java is started, /dev/ttyS1 does not exist (using the javacom to access it throws a NoSuchPortException) - this is expected. The problem is once the port is created, I still get the same exception. I can confirm that the port has been created sucessfully as minicom is able to communicate with the phone.

I have tried putting the javacomm code in a new class, and creating a new instance of this class once the port does exist, but this does not work. I have also used the enumerator to check all ports that are known and /dev/ttyS1 does not appear in the list.

If i run the command to create the port in a console before starting java then everything works althought this is obviously not acceptable as a final solution.

Does anyone have any thoughts / suggestions what might help fix this?


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!