1

I am running on Ubuntu 12.04. I am trying to communicate my Arduino with Java.

I have a source file SerialTest.java in directory /home/me/Desktop/folder

Inside the directory contains both RXTXcomm.jar, librxtxSerial.so, and my source code file.

I tried these methods to compile the SerialTest.java:

$ javac SerialTest.java

and I get the following errors:

SerialTest.java:4: error: package gnu.io does not exist

$ javac -verbose -classpath .:RTXXcomm.jar SerialTest.java

And I got the same error

SerialTest.java:4: error: package gnu.io does not exist

What I have referred to: javac -classpath not doing the trick

May I know what I am doing wrong? I am new to this. Thank you.

Community
  • 1
  • 1
zhengyue
  • 33
  • 1
  • 5

1 Answers1

1

Your classpath option is wrong. It should be:

-classpath .:RTXXcomm.jar

Note the colon (:). The semicolon (;) is used as a command separator by the shell.

What happens currently is that this command is executed:

javac -verbose -classpath .

Hence the first error: "no source files". And then this command is passed:

RTXXcomm.jar SerialTest.java

Hence the second error: "RXTXcomm.jar: command not found."

fge
  • 119,121
  • 33
  • 254
  • 329
  • Hi, thank you for your reply. The code got compiled however i still get the SerialTest.java:4: error: package gnu.io does not exist error. May i know if there is anything that i left out? Thanks. – zhengyue Mar 11 '14 at 10:31
  • You also need to specify the classpath when running your command – fge Mar 11 '14 at 10:39
  • Hi, this is the command that i typed javac -verbose -classpath .:RTXXcomm.jar SerialTest.java may i know if this is correct? I still get the error in which gnu.io does not exist. Thanks – zhengyue Mar 11 '14 at 11:40