Setting up Netbeans for pi4j remote debugging

307 views
Skip to first unread message

Kite

unread,
Oct 19, 2015, 3:42:09 PM10/19/15
to Pi4J
Hello everybody,

I already asked this in the RPi Java forum, but got no answer so far. So, I'll try again here, since I really try to get this working. However, I'm quite new to all the 'systems' involved here - Netbeans, Linux, Java. So, If anyone can help with this it would be great:

I'm trying to set up Netbeans 8.0.2 on a Win10 PC to remotely debug a GPIO-using Application on a Pi 2. I installed pi4j on the respective Pi (Raspian Jessie) and defined a remote debugging connection within Netbeans, and also did set up a pi4k-core.lib within Netbeans, just as indicated in several tutorials I found.

When I run a simple java application without accessing pi4j/GPIO, everything works fine, even using jframes is no problem at all. 

However, when I try to run the blinking led sample, the application does not start, giving me this failure notice:

debug:
Oct 18, 2015 9:51:43 PM com.pi4j.util.NativeLibraryLoader load
SEVERE: Unable to load [libpi4j.so] using path: [/lib/libpi4j.so]
java.lang.IllegalArgumentException: The path has to be absolute, but found: \lib\libpi4j.so
at com.pi4j.util.NativeLibraryLoader.loadLibraryFromClasspath(NativeLibraryLoader.java:120)
at com.pi4j.util.NativeLibraryLoader.load(NativeLibraryLoader.java:92)
at com.pi4j.wiringpi.Gpio.<clinit>(Gpio.java:174)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:51)
at com.pi4j.io.gpio.GpioFactory.getDefaultProvider(GpioFactory.java:106)
at com.pi4j.io.gpio.impl.GpioControllerImpl.<init>(GpioControllerImpl.java:54)
at com.pi4j.io.gpio.GpioFactory.getInstance(GpioFactory.java:89)
at GPIOTest.GPIOTestStart.main(GPIOTestStart.java:53)

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.pi4j.wiringpi.Gpio.wiringPiSetup()I
at com.pi4j.wiringpi.Gpio.wiringPiSetup(Native Method)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:51)
at com.pi4j.io.gpio.GpioFactory.getDefaultProvider(GpioFactory.java:106)
at com.pi4j.io.gpio.impl.GpioControllerImpl.<init>(GpioControllerImpl.java:54)
at com.pi4j.io.gpio.GpioFactory.getInstance(GpioFactory.java:89)
at GPIOTest.GPIOTestStart.main(GPIOTestStart.java:53)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

Robert Savage

unread,
Oct 26, 2015, 9:24:17 AM10/26/15
to Pi4J
Are you running the project from NetBeans using a Remote Platform configuration that configures the remote system as the Raspberry Pi's ip address/hostname ?  

If you attempt to run a program in NetBeans on the local system, it will fail with this type of error or similar error message.   I have had success using NetBeans and Pi4J and launching my project on the remote system via the NetBeans IDE and it works.  Basically the execution needs to take place on the Pi.

Are you building the Pi4J core libraries or using the pre-build downloadable JARs?

Thanks, Robert

Kite

unread,
Nov 7, 2015, 9:37:35 AM11/7/15
to Pi4J
Hi Robert,

yes, I configured NetBeans for remote debugging, adressing the pi directly by its ip adress. I use the prebuild jar, which I've put in some folder which is not a sub folder of the netbeans project I have.

By the way, I tried my code directly using a netbeans installationi directly on the pi (its a pi 2, netbeans runs, well, almost usable on that). Everything then works fine, so it does not seem to be a problem on the pi-side.

Thanks!
Reply all
Reply to author
Forward
0 new messages