28

Is it possible to run average java app server on e.g. jboss or glassfish server on Raspberry pi? Any limitations? Does anyone have an experience in Java development for raspberry pi?

At least any appropriate JVM for RPi will be nice.

asked Aug 23, 2012 at 11:40
2
  • Maybe this is more suited for programmers.stackexchange.com Commented Aug 23, 2012 at 11:42
  • 2
    As with many RPI questions, the answer is "why wouldn't it?". It's an ARM-Linux box like any other. Commented Aug 23, 2012 at 16:11

8 Answers 8

28

It's absolutely possible, but should work better with newer versions having more memory (e.g. the 512 MB version of the Pi). In December 2012 Oracle released a Developer Preview of Java SE 8 for ARM. The blog post with the announcement contains links to a number of tutorials which should get you started with plain Java SE or JavaFX, depending on how fancy your interfaces should be.

  1. Quickie Guide Getting Java Embedded Running on Raspberry Pi
  2. JavaFX on Raspberry Pi – 3 Easy Steps

If you are concerned about the performance of JavaFX on the Raspberry Pi, check the blog post "JavaFX on Raspberry PI", which contains some information about the performance of JavaFX, comparing it to native applications.

Update: Test results after running Tomcat 7 with Java 8 on the Pi
After I got the 512mb version of the Pi (MODELL B), I installed Java 8 and Tomcat 7.0 without any problems. Tomcat examples were working, and I was able to use the Tomcat manager application without any problems.

With 64 MB of RAM used for the graphics card, I still had 291 MB of free memory (with sshd running):

pi@raspberrypi ~/ $ free -m
 total used free shared buffers cached
Mem: 438 146 291 0 10 74
-/+ buffers/cache: 60 377
Swap: 99 0 99

pmap reported a total of 192 MB being used by the Tomcat process.

answered Dec 19, 2012 at 17:02
Sign up to request clarification or add additional context in comments.

2 Comments

Not yet, just go the 512 MB version today and will do some testing with it. I'll report the results here.
Note: you'll need one of the newer kernels to get access to 512Mb. The older kernels, such as the current raspbian for softfloat (2012年08月08日) only support 256Mb. You can get around this by using rpi-update to upgrade your kernel though.
12

Raspberry Pi has only 185MB available for the whole JVM. (after boot, with 16MB to video processing).

Then, you need to use aggresive and precise memory options (-Xmx120M -XX:MaxPermSize=55M -XX:ReservedCodeCacheSize=4M -Djava.awt.headless=true)

I have made an application based on Jetty, Spring 3 and Hibernate/JPA. Just after deployment, it fit in about 15MB of Heap space and 32MB of non heap space (using JProfiler memory analysis)

Each loaded class is permanent memory lost, because PermGen space can't be garbage collected. A lot of classes are loaded only for initialization support, but will stay loaded forever. Maybe tweeks can be found to consume less PermGen space for each component.

answered Aug 30, 2012 at 11:37

1 Comment

What about -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled, when you use it with corrent GC settings then it should be able to remove classes from permgen, at least it does it on normal x86 machines. I am not sure how different the ARM JVM is.
8

You can indeed. There is a blog post of someone running JBoss EAP (essentially JBoss AS 7) on a raspberry pi.

answered Aug 23, 2012 at 16:07

Comments

4

I use TJWS on Raspberry Pi under JRE 1.7, it works incredibly fast and no memory issues.

answered Jan 13, 2013 at 9:59

Comments

2

Right now, a JVM on the pi is possible but a Java SE edition is hard to find. There may be one for ARM from Oracle, but I haven't tried it (my pi is still on it's way) and if memory serves it's behind a wall.

Another limitation for the pi is the available RAM; apps like jboss and glassfish are going to want more RAM than the pi provides, except under very constrained deployments.

answered Aug 23, 2012 at 12:24

3 Comments

I'm developing a web application with Spring and Jetty. I think raspberry pi will be able to run it, but did not test, i'm still waiting to receive it :)
It should be able to run it as long as the JVM is capable. There are JVMs providing JavaSE for ARM: oracle.com/technetwork/java/embedded/downloads/javase/… but as I don't have the pi yet I can't try anything out. :)
My pi is here, and it does indeed run the ejre from Oracle. Watch for memory consumption, as detailed elsewhere, but that's part of the way the world is for embeddable devices.
1
answered May 17, 2015 at 23:57

Comments

0

Ive got tomcat7 running on openjdk with sqlite databases. Processing ok at around a quater speed of my laptop, but opening jsp pages takes 10-15 seconds. Not sure why yet.

answered Aug 19, 2013 at 19:54

Comments

0

in case you want to use java 11 and javafx I found this is definitely possible with the Liberica JDK of BellSoft: https://bell-sw.com/pages/java-11.0.3

Install scripts and demo application are available on my blog: https://webtechie.be/2019/04/16/pijava-overview-java-11-and-javafx-11-on-raspberry-pi

To install JDK 11.0.2:

# Make sure we are in the home directory
cd /home/pi
# Download the Java 11.0.2 distribution from BellSoft
wget https://download.bell-sw.com/java/11.0.2/bellsoft-jdk11.0.2-linux-arm32-vfp-hflt.tar.gz
# Move the downloaded file to /opt
sudo mv bellsoft-jdk11.0.2-linux-arm32-vfp-hflt.tar.gz /opt
# Use the /opt directory
cd /opt
# Untar the downloaded file
sudo tar -xvzf bellsoft-jdk11.0.2-linux-arm32-vfp-hflt.tar.gz
# Remove the downloaded file
sudo rm bellsoft-jdk11.0.2-linux-arm32-vfp-hflt.tar.gz

Testing and running Java file without compiling:

cd /home/pi
nano HelloWorld.java
public class HelloWorld {
 public static void main (String[] args) {
 System.out.println("Hello World");
 }
}
/opt/jdk-11/bin/java /home/pi/HelloWorld.java
Hello World
answered May 29, 2019 at 7:34

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.