SirSlo
Posts: 4
Joined: Thu Aug 01, 2013 8:32 pm

ImageJ for the Java Impaired

Thu Aug 01, 2013 8:51 pm

There have been several different sites that make the claim that the Raspberry Pi can run ImageJ, and there is a little talk about it around here and there, but there isn't really a source to help people looking to do this for themselves.

I've been smashing my poor brain cells against this problem all week, but I think a combination of staring at the same problem too long and a lack of Java know-how have led me to a dead end. Or my problem could be my use of the economy Pi (Sans Ethernet port, secondary USB, etc).

So far I have:

-Installed the Debian Squeeze
-Resized the partition to take up the remainder of the unallocated space on my 4gb SD (~512MB left for Linux swap)
-Edited /etc/network/interfaces with my wifi information for internet connectivity
-Updated with sudo apt-get update
-Installed JDK1.7.0 (ejre-7u21-fcs-b11-linux-arm-vfp-client_headless-04_apr_2013.tar.gz)
-Modified the PATH to make it easier to call (argh that is probably not the right term).
-Downloaded a copy of ImageJ (ij147-linux32.zip)
-Proceeded to attempt every permutation of java -jar ij.jar I could imagine might have any effect.
-Downloaded what I believe is the "headless" version here http://sourceforge.net/projects/imageja ... =directory and made a valiant effort to use it as classpath before ij.jar.

The error I consistently get at this point is:
Exception in thread "main" Java.awt.HeadlessException
java.awt.GraphicsEnvironment.checkheadless(GraphicsEnvironment.java:207)
At Java.awt.Window.<init>(Window.java:535)
At Java.awt.Frame.<init>(Frame.java:420)
At ij.ImageJ.<init>(ImageJ.java:137)
At ij.ImageJ.main(ImageJ.java:670)

If there is anyone who has accomplished this task I would very much appreciate any help you can offer. Thanks in advance,

-Slo

User avatar
jbeale
Posts: 3701
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: ImageJ for the Java Impaired

Thu Aug 01, 2013 11:34 pm

Should this go in the "Java" forum? http://www.raspberrypi.org/phpBB3/viewforum.php?f=81

User avatar
crackers
Posts: 55
Joined: Fri Dec 28, 2012 7:45 am

Re: ImageJ for the Java Impaired

Fri Aug 02, 2013 5:10 am

The "headless" version is intended primarily for servers where the use of graphics is not ever going to be required. In order to run a graphics program, you need to install the full JRE.

SirSlo
Posts: 4
Joined: Thu Aug 01, 2013 8:32 pm

Re: ImageJ for the Java Impaired

Fri Aug 02, 2013 2:53 pm

crackers wrote:The "headless" version is intended primarily for servers where the use of graphics is not ever going to be required. In order to run a graphics program, you need to install the full JRE.
Would you happen to have a link or version # that is known to operate on the Pi? Since I have limited Java knowledge I have mainly been following tutorials that essentially just lead me to the most updated version download page. > . <

SirSlo
Posts: 4
Joined: Thu Aug 01, 2013 8:32 pm

Re: ImageJ for the Java Impaired

Fri Aug 02, 2013 4:57 pm

Now attempting installation of jdk-8-ea-bin-b100-linux-i586-25_jul_2013.tar.gz... scratch that, realized my mistake part way. Downloading and installing the jre-8-ea-bin-b100-linux-i586-25_jul_2013.tar.gz....

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: ImageJ for the Java Impaired

Fri Aug 02, 2013 11:00 pm

You seem to be trying to install on Debian Squeeze, which is only an armel (ARM CPU software-emulated floating point only) distro on the Pi, which is going to run very slowly, assuming you can overcome the dependency problems you're having. ImageJ can be easily installed on Raspbian using:

Code: Select all

sudo apt-get install imagej
That will also install any necessary Java and other dependencies for armhf (ARM CPU hardware floating-point unit support, which typically speeds image processing software up by at least 10-fold), including OpenJDK, IcedTea, etc. It will also install a menu item under Graphics on the LXDE X desktop which will enable you to run it with a couple of mouse clicks, but it will take about a half a minute to load ImageJ, and opening images can take up to a minute to load (e.g., from the included samples).

You probably don't want to be running anything else to keep the load on the CPU to a reasonably dull roar. As with most graphics software run on the Pi that doesn't take advantage of the graphics processing unit (GPU), it will run, just slowly. When Oracle Java 7 for the Pi is reportedly released this Fall, it will include full GPU support, and that should make running applications like ImageJ significantly faster.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

User avatar
jbeale
Posts: 3701
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: ImageJ for the Java Impaired

Sat Aug 03, 2013 12:00 am

Jim Manley wrote:When Oracle Java 7 for the Pi is reportedly released this Fall, it will include full GPU support, and that should make running applications like ImageJ significantly faster.
Is this actually true, Oracle is willing to do that amount of development to support a platform like Raspberry Pi? I'm quite amazed.

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: ImageJ for the Java Impaired

Sat Aug 03, 2013 2:59 am

jbeale wrote:
Jim Manley wrote:When Oracle Java 7 for the Pi is reportedly released this Fall, it will include full GPU support, and that should make running applications like ImageJ significantly faster.
Is this actually true, Oracle is willing to do that amount of development to support a platform like Raspberry Pi? I'm quite amazed.
Hi "j" :)

Oracle has been working on this pretty much since demos early in 2012, albeit apparently part-time by some internal champions of the Pi and ARM, at least until earlier this year. First-class support of the Pi has been on their roadmap for close to a year (announced at JaveOne in 2012, IIRC), although it has been under the umbrella of greatly-improved support for ARM in general. So, they're not doing this solely for the Pi - the benefits will apply equally to any ARM-Linux platform such as a Cubieboard, BeagleBone, etc. According the roadmap, Java 8 (coming sometime in the first half of 2014, IIRC) will include full ARM-Linux (including Pi) support the day it's released to the public.

I know a lot of people hold a great deal of hate and discontent for Oracle, but one has to remember that it's a huge company that got that way in large part by acquiring a lot of outstanding smaller companies (and in some cases, not small at all, just smaller relative to Oracle's core database business, e.g., Sun, Siebel, BEA Systems, Hyperion, PeopleSoft, etc.). The people working on Java for ARM are, of course, formerly Sun employees, some of whom have been at work on Java since the very early days. One of things Sun and Oracle had in common was their software supporting as many platforms as possible, which led to a lot of internal friction between the hardware and software folks within Sun, and that probably partly led to its acquisition by Oracle. So, this shouldn't be as much of a surprise as it might otherwise seem.

Oracle, and the Java division in particular, have a long and deep history of association with educational use, including very liberal licensing in that sector, generally for free for educators and students, in particular, and even pre-investment small startups. The sister of a former coworker of mine was (and may still be) the head of licensing at Oracle and they have offered a wide range of licensing options even to corporate customers when they've been asked. This has been useful where cash has been strapped, e.g., growing startups demonstrating promise of strong future profits. Sometimes going with Oracle exclusively is part of the deal, in other cases they've accepted preferred stock and/or warrants in exchange for licensing breaks, etc. As the MBAs like to say, "Everything is negotiable."

Having said all of that, I haven't heard from the folks working on the ARM-Linux ports since earlier this year and things may have changed, but they haven't announced anything of which I'm aware. They do monitor this forum at least occasionally, and I hope we hear from them sooner, rather than later, that Java 7 on the Pi will, in fact, be here Real Soon Now.

EDIT: I forgot to mention that there is a developer preview of JDK 8 that runs very well on Raspbian (full armhf implementation last updated on July 24, 2013) that's available at:
http://jdk8.java.net/download.html
You will want the Linux ARMv6/7 VFP, HardFP ABI gzipped tarball that becomes accessible when you agree to the licensing terms. The JavaFX Demos and Samples Downloads are available in zipped form below the JDK downloads on the same page. There are some useful notes toward the bottom of the page at:
https://wiki.openjdk.java.net/display/O ... spberry+Pi
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: ImageJ for the Java Impaired

Sat Aug 03, 2013 10:58 am

SirSlo wrote:Now attempting installation of jdk-8-ea-bin-b100-linux-i586-25_jul_2013.tar.gz... scratch that, realized my mistake part way. Downloading and installing the jre-8-ea-bin-b100-linux-i586-25_jul_2013.tar.gz....
These are versions for Intel processors (note the i586 in the name). You need the versions built for the Pi's ARM processor.

SirSlo
Posts: 4
Joined: Thu Aug 01, 2013 8:32 pm

Re: ImageJ for the Java Impaired

Mon Aug 05, 2013 6:51 pm

Just want to take a moment to thank everyone for the replies here. There's some really fantastic information in this short page, and I'm really lucky to run into people who clearly know their stuff.

Thank you.

I'm going to go forward, using ejre-7u21-fcs-b11-linux-arm-vfp-client_headless-04_apr_2013.tar.gz, and continue to try and get it up and running on the Debain Squeeze while preparing a second SD card with Raspian.

Update - Same error as in my original post on this thread with the ejre-7u21-fcs-b11-linux-arm-vfp-client_headless-04_apr_2013.tar.gz. Moving on to Raspian to attempt the JDK 8.

Octahedron
Posts: 1
Joined: Sun Aug 30, 2015 4:07 pm

Re: ImageJ for the Java Impaired

Sun Aug 30, 2015 4:37 pm

Well I am just diving in and when installing it on windows I used the Platform Independent version ( ij149.zip ). So if it worked once why not again and just copied the files to: /home/pi/Java/ImageJ. I ignored the installation advice, how else am I going to learn Linux if I don't get myself in trouble, and just ran "java -Xmx512m -jar ij.jar" from the command line in said directory (see the run file in ImageJ). Up it popped and did a Fourier transform of a 19MB rPi camera shot of yours truly. After a couple of minutes there-she-blows a Fourier transform of the picture. I am running Noobs, rightfully so, with installed Raspian (?) and a RaspberryPi 2 with the gig of ram. I did previously install java using sudo apt-get install -y openjdk-7-jdk geany (got that from issue 14 of MagPi). Well I am off to get into more trouble, if you want some more details of what I did feel free to ask but I do not "forum" that much. As a matter of fact I am leaning towards becoming a Luddite because of the fast changes in just about everything. My next thing is to get a clean Noobs and try installing JDK 8 and JRE 8 and see if ImageJ runs and maybe runs faster.

Cheers.

FYI, If you need advice I would go to someone who knows about this stuff and not me. I would likely not be very helpful and the RPi community is huge, informed and best of all helpful.

Return to “Java”