incises
Posts: 3
Joined: Sat Mar 05, 2016 5:35 pm
Location: Carcassonne - France

Problem executing java prog using Pi4J library

Sat Mar 31, 2018 1:05 pm

I recently bought my first RPi, included in a CanaKit Raspberry Pi 3 Complete Starter Kit - 32 GB Edition from Amazon.

I intended to program it in Java, using the Oracle book Raspberry Pi With Java.

My Pi is under Raspbian and my current PC under Ubuntu 16.04.

I installed Netbeans 8.1 from Ubuntu packages on my PC.

Now, as I processed to launch my first java program from Netbeans, it did not work : I got these error messages :
ant -f /home/cassian/NetBeansProjects/Pi4JLed -Dnb.internal.action.name=run -Dremote.platform.rp.target=linuxarmvfphflt-15 -Dremote.platform.password=***** -Dremote.platform.rp.filename=linuxarmvfphflt -Dremote.platform.java.spec.ver=18 run-remote
init:
Deleting: /home/cassian/NetBeansProjects/Pi4JLed/build/built-jar.properties
deps-jar:
Updating property file: /home/cassian/NetBeansProjects/Pi4JLed/build/built-jar.properties
Compiling 1 source file to /home/cassian/NetBeansProjects/Pi4JLed/build/classes
compile:
Copying 1 file to /home/cassian/NetBeansProjects/Pi4JLed/build
Copy libraries to /home/cassian/NetBeansProjects/Pi4JLed/dist/lib.
Building jar: /home/cassian/NetBeansProjects/Pi4JLed/dist/Pi4JLed.jar
To run this application from the command line without Ant, try:
java -jar "/home/cassian/NetBeansProjects/Pi4JLed/dist/Pi4JLed.jar"
jar:
Connecting to 192.168.1.18:22
cmd : mkdir -p '/home/pi/NetBeansProjects//Pi4JLed/dist'
Connecting to 192.168.1.18:22
done.
profile-rp-calibrate-passwd:
Connecting to 192.168.1.18:22
cmd : cd '/home/pi/NetBeansProjects//Pi4JLed'; '/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java' -Dfile.encoding=UTF-8 -jar /home/pi/NetBeansProjects//Pi4JLed/dist/Pi4JLed.jar
Unable to determine hardware version. I see: Hardware : BCM2835
,
- expecting BCM2708 or BCM2709.
If this is a genuine Raspberry Pi then please report this
to projects@drogon.net. If this is not a Raspberry Pi then you
are on your own as wiringPi is designed to support the
Raspberry Pi ONLY.
So Pi4J connected correctly to the Pi but complained about not finding the correct processor.
It surprised me as the BCM2835 seems to be a processor for at least some Pis...

Somes ideas ? Clarifications ? Should I buy another Pi and if so which one ? Or are there other versions of Pi4J ?
Any explanation, advice, link welcome.

User avatar
DougieLawson
Posts: 35789
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Problem executing java prog using Pi4J library

Sat Mar 31, 2018 7:44 pm

You have to use WiringPi v2.46 with the 4.9 & 4.14 kernels and on a RPi3B+

https://github.com/Pi4J/pi4j/issues/319
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

incises
Posts: 3
Joined: Sat Mar 05, 2016 5:35 pm
Location: Carcassonne - France

Re: Problem executing java prog using Pi4J library

Sun Apr 01, 2018 11:12 am

Thank you for the very much interesting link.

For the time being, it seems things work fine for me after downloading the pi4j-1.2-SNAPSHOT.zip, as mentioned in your link, and using pi4j-core.jar as library.

However, as somebody said that pi4J was « dead », it would perhaps be better not to use it in our java programs
and directly use WiringPi, was it what you implicitly suggested ?

EDIT for the time being the kernel on my RPi is 4.14.30-v7

User avatar
DougieLawson
Posts: 35789
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Problem executing java prog using Pi4J library

Sun Apr 01, 2018 11:18 am

pi4j isn't quite dead, yet. The github stuff got a commit on 15th Jan - so someone appears to be doing some maintenance.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Java”