Go Down

Topic: 0017 libraries with java serial example (Read 720 times) previous topic - next topic

mathieu jofis

Nov 15, 2009, 06:58 pm Last Edit: Nov 15, 2009, 07:00 pm by mathieujofis Reason: 1
There are a few examples showing how to implement a serial connection in java using the Processing libraries to talk to the arduino.

http://www.arduino.cc/playground/Interfacing/Java
http://silveiraneto.net/2009/03/01/arduino-and-java/

But, it seems that Preferences.init() has been changed for 0017.  I did find a work around. (See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251256638 )

I added the PrefsHack class as instructed, but as magitek described in that post I too get a bunch of NullPointerExceptions.

Code: [Select]
Exception in thread "main" java.lang.NullPointerException
       at processing.app.Preferences.getDefault(Preferences.java:788)
       at processing.app.Preferences.getFont(Preferences.java:874)
       at processing.app.Preferences.<init>(Preferences.java:372)
       at serialtest.PrefsHack.<init>(PrefsHack.java:14)
       at serialtest.Main.main(Main.java:58)
Java Result: 1

Anyone know how to get around this? Is there any documentation for the Processing libraries?

mathieu jofis

Resolved.  Amateur mistake; tried to construct an instance of the PrefsHack library when the method I was trying to get at was static (and there was no constructor anyways).

Go Up