WillemD
Posts: 29
Joined: Sat Jan 31, 2015 11:25 am

java me or java se, add jdk.dio or pi4j

Sun Feb 08, 2015 2:43 pm

Getting totally confused and frustrated (because "simple" things are not working). Need some advice on java versions.

I have built a robot with motors, leds, ir wheel encoders, sonar, and pan/tilt servo's. So far I have been using java ME8 and netbeans (and followed a large part of the Oracle MOOC course on java me). All things where I had to use direct gpio input and output are working fine. Then I got to servo control and needed to use servoblaster but was unable to open /dev/servoblaster to send commands to it. (see my other posted question on pwm control in this forum).

After spending several days on it I decided to try JAVA SE instead. Then I can easily open /dev/servoblaster, servos are working fine, very easy, but I am loosing the capability to do direct io to the gpio ports. I managed to add the jdk.dio libraries to the project in netbeans but am unable to run the commands subsequently on the raspberry PI.

So which route to go:
1) continue to use JAVA ME but how to solve the access issue to /dev/servoblaster
2) switch to JAVA SE which solves the servoblaster issue, but then how to control gpio in the same way as I am used to in JAVA ME
3) use JAVA SE and PI4J, rewrite what I have done so far
4) other options ? .....

Did a lot of googling, found a lot of info, also a lot of outdated info, which does not really help and just adds to the confusion.

Who can offer some advice?

Thanks,

Willem
Last edited by WillemD on Mon Feb 09, 2015 11:29 am, edited 1 time in total.

User avatar
clicky
Posts: 499
Joined: Thu Oct 25, 2012 7:34 am

Re: java me or java se, add jdk.io or pi4j

Sun Feb 08, 2015 8:30 pm

As someone who really liked pi4j - I would say jdk + pi4j. There are plenty of examples and it is proven to work.

No idea how good java me is nor jdk.io managed to get me attracted to it. Especially in the early days...

User avatar
Fidelius
Posts: 460
Joined: Wed Jan 01, 2014 8:40 pm
Location: Germany

Re: java me or java se, add jdk.io or pi4j

Mon Feb 09, 2015 9:47 am

I too would always use a Java Standard-Edition (SE), where possible, and avoid the castrated "Java ME" edition.

Also, Raspbian has Oracle's Java8 (an SE version) pre installed, which often helps.

WillemD
Posts: 29
Joined: Sat Jan 31, 2015 11:25 am

Re: java me or java se, add jdk.dio or pi4j

Mon Feb 09, 2015 11:36 am

In the meantime, option 1 is out of the window, since JAVA ME cannot open a pipedoutputstream and also is not able to exec runtime OS commands, which were the two options available to write to /dev/servoblaster.
I found a link how to install jdk.dio on the raspberry (for option2) so it should then be possible to re-use the ME GPIO programs which I have already written, but then from within JAVA SE. I'll give it one more try, if it does not work, then I will restart and write using PI4J, option 3.

WillemD
Posts: 29
Joined: Sat Jan 31, 2015 11:25 am

Re: java me or java se, add jdk.dio or pi4j

Mon Feb 09, 2015 7:58 pm

For the download and installation of jdk.dio from the openjdk website I should use the following commands:
hg clone http://hg.openjdk.java.net/dio/dev
cd dev
export PI_TOOLS=<path to raspberry pi toolchain>
export JAVA_HOME=<path to JDK8>
make

I assume these commands have to be typed on the raspberry? It already fails on the first command since the command hg cannot be found. I hate it if installations instructions are not clear, are wrong or just assume other knowlegde ...... pi4j here I come, I am going to switch. Fed up with JAVA ME and JDK.DIO

herriejr
Posts: 5
Joined: Thu Feb 07, 2013 9:01 am

Re: java me or java se, add jdk.dio or pi4j

Fri Jul 31, 2015 6:46 am

Like it says on the main wiki page of openjdk jdk.dio, it is a Mercurial repository.

You first have to install Mercurial

Code: Select all

sudo apt-get install mercurial
and then the hg command will be available.

User avatar
savageautomate
Posts: 228
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: java me or java se, add jdk.dio or pi4j

Sun Sep 06, 2015 2:42 am

WillemD,

What did you end up using DIO or PI4J. Just curious on your experience and what led to your final decision.

Thanks, Robert
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

praky
Posts: 3
Joined: Tue Jan 12, 2016 7:51 am

Re: java me or java se, add jdk.dio or pi4j

Wed Jan 13, 2016 11:44 am

He ended up using java se with jdk.dio as evident with his post here-
https://community.oracle.com/thread/367 ... 0&tstart=0

riftware
Posts: 1
Joined: Fri Sep 13, 2013 3:45 am

Re: java me or java se, add jdk.dio or pi4j

Tue Mar 29, 2016 3:34 am

Actually that linked post shows that he used both - DIO for gpio pin control and pi4j for the pwm implementation.

Return to “Java”