Java and Arduino

I'm wanting to use Java to control a robot project via an arduino nano, but I'm having problems getting Java to recognise the tty device that the nano is on (/dev/ttyUSB0, works in the arduino IDE)

I'm using the javax.comm package for serial communication,and have the sample program located here: http://www.javaworld.com/jw-09-1998/indepth/SimpleWrite.java as a demonstration of how to write data using the package. However, it seems /dev/ttyUSB0 is not recognised at all, as it I put "System.out.println(portId.getName());" in the while loop, the only output to console is the following:

/dev/ttyS0 /dev/ttyS1

I know these are the serial ports historically, but this being an eee pc, I dont have any physical serial ports. Is there a way perhaps to link one port to another, so that I could output to ttyS1 and it be sent to ttyUSB0?

Can anybody suggest a better way of doing it? Or a reason why it's not working? Examples would be appreciated!

Cheers.

Can you send/receive bytes with an arduino using /dev/ttyUSB0 ? The iDE uses RXTXcomm BTW.

Yes, I set up a little program to respond whenever I sent data, and using the serial monitor in the IDE, if I run “echo ‘hi’ > /dev/ttyUSB0” then I get a response from the chip.

Should I be using the RXTXcomm package rather than the official comm package then?

I don't know the details, just pointing out there is a difference there.

If you are writing something for other arduino users to use, then I might just link into the rxtx jar files that come with arduino though. And maybe even borrow the COM port identified in the preferences.txt file. That port SHOULD work, they just uploaded a script with it :)

I can run getPortIdentifiers on rxtx and see COM5 (xp). Never figured out how to get the com api working as it didn't seem platform independent enough so you might want to run a test or three.

Using the rxtx library that came with the arduino IDE (011) worked :)