catman232
Posts: 2
Joined: Wed Aug 10, 2011 12:55 am

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 1:57 am

Hello, I am new to these forums...

I am a Java developer and I was wondering if the Raspberry Pi can run Java.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 2:11 am

It shouldn't have a problem doing so. We know that Java can run on an ARM processor with no problem already (it is running on most of our cell phones), the only real question is does whichever OS you go with already have a JAVA package for you to install off of? But even then, the worst case scenario is you have to compile the source code yourself
Dear forum: Play nice ;-)

Cafe
Posts: 62
Joined: Thu Jul 28, 2011 2:22 am

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 2:55 pm

Everything abishur said above plus potentially insufficient amount of memory depending on the Raspi model and the application needs.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 3:28 pm

Very true! There's a world of difference between Java itself being able to run, and any given Java application being able to run!
Dear forum: Play nice ;-)

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5202
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 8:39 pm

I've spoken to Eben about this - at the moment we *expect* that Java will run, but obviously this is something we need to nail down. I should have an answer for you in a couple of weeks' time.
Director of Communications, Raspberry Pi

gerits
Posts: 50
Joined: Thu Aug 04, 2011 11:50 am

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 9:04 pm

I think a language like c/c++ is better for this kind of devices. In java you can't control the memory as well as in c++, and c++ doesn't need a virtual environment to run...

catman232
Posts: 2
Joined: Wed Aug 10, 2011 12:55 am

Re: Will the Raspberry Pi run Java?

Wed Aug 10, 2011 9:42 pm

Quote from abishur on August 10, 2011, 03:11
It shouldn't have a problem doing so. We know that Java can run on an ARM processor with no problem already (it is running on most of our cell phones), the only real question is does whichever OS you go with already have a JAVA package for you to install off of? But even then, the worst case scenario is you have to compile the source code yourself

Thanks ;)

benjamin.balet
Posts: 4
Joined: Mon Aug 08, 2011 2:41 pm
Contact: Website

Re: Will the Raspberry Pi run Java?

Thu Aug 11, 2011 12:54 pm

Am I mistaken or your device will use a ARM1176JZF-S based CPU ? If so, this CPU implements Jazelle V1 technology. It executes Java bytecodes either by hardware or by software, depending on the complexity.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Will the Raspberry Pi run Java?

Thu Aug 11, 2011 2:03 pm

That is exactly what the r-pi uses!
Dear forum: Play nice ;-)

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Fri Sep 02, 2011 12:23 pm

Hiya folks, as something of a pundit on the nature of Java on embedded devices, I should toss in a couple of comments here.

Firstly, you should know I am massively biased about Java support, as all our games are written in Java. They do unfortunately use a bit more RAM than is available on the RPi but that is largely a function of the large quantity of graphics and sound in them and a fairly desktop-oriented approach to RAM usage (that is: we rely on a swapfile).

Anyway - the long and the short of Java support on ARM is this: there is only one worthwhile VM available for ARM, which is made and maintained exclusively by Oracle. JDK6 Embedded comes in both headless and full AWT versions, although only the client version of the Hotspot compiler is implemented. I've actually used this very VM on a prototype board housing a 700MHz Tegra SOC and it was more or less as fast as a desktop CPU of the same clockspeed running Java; that is to say, about 50% or so of the raw computing power of C++ on average, which is absolutely adequate to do games such as Quake3 at 60Hz (as easily fast enough for our smaller games).

Despite having fairly extensive tendrils inveigling their way through Sun Microsystems I've been unable to convince Oracle to license me their Java 6 JRE on reasonable terms for my own special purposes, but it is possible that RPi will manage to convince Oracle of the merits of getting Java onto this device and maybe come up with an affordable licensing scheme for it.

The other alternatives I've investigated are the IcedTea/Shark OpenJDK efforts but these are basically experimental and involve hair pulling, swearing, etc. and generally wasting your time. Java, for the developer, is about stuff just working and working properly, and if you have to involve yourself in the horrible world of C then it's essentially a big fail.

The OP is almost certainly aware of the benefits of having Java on the device, but in case RPi aren't so familiar with why it's so good: Java is the new BASIC. Any fool can write it (and write it anywhere!). It's fantastic and teaches proper programming. It's not as fast as C but most of us would rather something just compiled and ran without the aforementioned hair loss and expletives.

Also: we have LWJGL compiled for ARM and OpenGL ES. If only we had a JVM...

Cas :)

lehphyro
Posts: 2
Joined: Fri Sep 02, 2011 1:58 pm

Re: Will the Raspberry Pi run Java?

Fri Sep 02, 2011 3:00 pm

It seems ubuntu already has openjdk packages ready for arm: https://launchpad.net/ubuntu/natty/armel/openjdk-6-jdk

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Fri Sep 02, 2011 3:09 pm

Reckon that's running Zero, the hopelessly slow interpreter-only JVM.

Cas :)

yoonsikp
Posts: 22
Joined: Wed Aug 31, 2011 3:07 pm

Re: Will the Raspberry Pi run Java?

Fri Sep 02, 2011 3:23 pm

We could try this
http://java.sun.com/javame/lic...../index.jsp
Im not sure if that runs on ARM though

Svartalf
Posts: 596
Joined: Fri Jul 29, 2011 6:50 pm

Re: Will the Raspberry Pi run Java?

Fri Sep 02, 2011 3:45 pm

Quote from yoonsikp on September 2, 2011, 16:23
We could try this
http://java.sun.com/javame/lic...../index.jsp
Im not sure if that runs on ARM though

Yes, it will, so long as you compile it for that- it's a J2ME implementation, though.

HermanStehouwer
Posts: 4
Joined: Tue Aug 30, 2011 3:02 pm

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 1:58 pm

I am also very interested in getting Java up and running on the device.
I have no experience working with embedded devices, and going by what Cas says it might be an issue.

Considering that I would like to make a small "archive-box" based on our software I will at least spend some time trying to get the thing to run.

On the positive side, there seem to be a few dozen opensource JVM implementations.
One of them is bound to work :P

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24971
Joined: Sat Jul 30, 2011 7:41 pm

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 3:47 pm

Given that the GPU code is entirely C (and assembler), I'd would profoundly disagree that C is a big fail. Oh, and the kernel is also all written in C. And many of those mobile phones that appear so popular nowadays!

Java may be good for games and certainly has its place, but not so good for work where you need to maintain decent performance. Any fool can write it? Surely.

Dealing with Oracle though? Yuuuugghhhh.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

hsalonen
Posts: 19
Joined: Wed Aug 31, 2011 9:11 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 4:29 pm

gcc has ARM targets. Can the VM that GCJ embeds used with R-PI?

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 8:16 pm

My reasonably extensive investigations with others currently show me GCJ went nowhere and wasn't exactly producing particularly fast code (notably the GC implementations were very weak).

All of the open source JVMs out there are barely functional let alone fast.

And C is of course notionally the best language for kernels and device drivers, but it is also of course not what most of us want to program :) Java fits the requirements of applications programmers very nicely.

Cas :)

DanielSilva
Posts: 71
Joined: Sun Aug 28, 2011 7:07 pm

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 8:46 pm

Well you have three choices then, don't use Java ( i wouldn't use it for desktops applications even on a full fledged computer much less on a system like raspi ), use the "slow, open-source" version or wait for Shark to be finalised and released.

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 9:10 pm

There is a fourth choice but it sort of depends on RaspberryPi.org and Oracle being best friends. Stranger things have happened at sea but don't discount it! Their VM is after all mostly sat there doing bugger all as they've failed to convince anyone to license it.

It's absolutely great for desktop apps - see Eclipse and Netbeans for starters - just fairly rarely used. It's not even common in games, which is where we are, but it isn't half easy compared to anything else.

Cas :)

iAreNewb
Posts: 59
Joined: Sun Aug 28, 2011 4:27 pm

Re: Will the Raspberry Pi run Java?

Sat Sep 03, 2011 11:43 pm

I would love for Java to be available, but as is, I don't think that's possible. When considering the CPU/RAM limitations of the current R-Pi, on top of licensing/porting issues, I think that Java is another bullet point on the list of things to shove onto the next R-Pi iteration.

As for using C, I'm sure that running other fully open source languages (in terms of compilers & interpreters) that are ported to C is fine. C itself is probably too difficult to work with for most beginning programmers. C++, Cython, and some Lisp dialects would definitely be nice. Maybe even some assembly for those who want to dive from C++ to even lower-level programming, or for optimization and enlightenment. C, though, is a language that I, and most others, I think, would nail as only for the most speed-critical, or system-level, applications.

bnolsen
Posts: 76
Joined: Sat Aug 13, 2011 5:37 pm

Re: Will the Raspberry Pi run Java?

Sun Sep 04, 2011 2:36 am

For teaching java would IMHO be a bad idea. It's still a compiled language and not as beginner friendly as python or ruby might be. But having a JVM wouldn't be *horrible*, considering android still does java. I personally don't let java anywhere close to any of my machines, but that's just me, and from what I can tell is pretty common for most people who run linux, bsd, etc on their desktops.

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Will the Raspberry Pi run Java?

Sun Sep 04, 2011 10:20 am

I wouldn't let CPU or RAM considerations get in the way of whether people want Java or not (which is not what this thread is about); as I have said, I've used the Oracle embedded JRE and it's every bit as fast as the desktop version even in the very constrained environment I tried it on.

Access to a JVM doesn't necessarily mean having to use Java either - there are a lot of other languages that run on the JVM, which would otherwise be slow. The most important consideration though is that nobody would have to make any ARM ports of the enormous pile of useful libraries and languages out there for Java. It all Just Works.

Cas :)

DanielSilva
Posts: 71
Joined: Sun Aug 28, 2011 7:07 pm

Re: Will the Raspberry Pi run Java?

Sun Sep 04, 2011 1:58 pm

"It all Just Works" is being a bit optimistic, things don't work exactly like that and you of all should know better. That is something that irks me every time ....

I wrote enough J2EE web applications to know that it simply doesn't work like that, you will always be "limited" by different JVM implementations, different behaviours even using the same JVM in different architectures, people sticking non pure java libraries ( JNI ) into stuff, etc.

Anyway that completely besides the point and for most things that the raspi should be used, even the opensource jdk should be sufficient.

frafra
Posts: 19
Joined: Sun Aug 28, 2011 2:20 pm
Contact: Website

Re: Will the Raspberry Pi run Java?

Sun Sep 04, 2011 3:42 pm

It could be nice, with hardware acceleration (like ARM Jazelle), but Java programs sometimes doesn't work so well as you could think. Yesterday Linus Torvalds just said: "I'm tired of java programs that don't work" :D

Return to “General discussion”