Difference between revisions of "RPi Java"
(→General tips) |
m (→Oracle Java 8: Removed the invalid zxf parameter to the rm command) |
||
Line 25: | Line 25: | ||
wget http://www.java.net/download/JavaFXarm/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz | wget http://www.java.net/download/JavaFXarm/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz | ||
tar zxf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz | tar zxf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz | ||
− | rm | + | rm jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz |
sudo mv ./jdk1.8.0/ /opt/ | sudo mv ./jdk1.8.0/ /opt/ | ||
sudo chown root:root -R /opt/jdk1.8.0/ | sudo chown root:root -R /opt/jdk1.8.0/ |
Revision as of 01:27, 14 March 2013
Contents
General tips
Some general tips about Java perfomace on Raspberry Pi.
System memory
Java loves memory. If you do not plan to use desktop enviroment / XBMC run sudo raspi-config
select memory_split and decrease GPU memory to 16. You'll get more than 100 Mb of additional system memory.
Swap file
Do not swap! Manage your JVM memory consumption with -ms
and -mx
keys. If you absolutely have to swap move swap file (/var/swap) to USB HDD of fast flash drive because swapping to SD card is painfully slow. You can set swap size in /etc/dphys-swapfile config file.
Overclocking
Consider CPU overclocking with sudo raspi-config
for considerable performance boost.
Installing Java on Raspberry Pi
Oracle Java 8
Oracle JDK 8 for ARM has JIT compiler and supports hard float point instructions. This is the fastest (1.5x-10x times faster than other JVMs) Java option for Raspberry Pi. Please note that Java 8 is still in beta stage and may be less stable than Java 7. You can install it on standard Raspbian system.
- Visit JDK 8 for ARM Early Access web site, accept License Agreement, right click and copy download link.
- Login to you Pi via ssh and run:
# you download link from step 1 wget http://www.java.net/download/JavaFXarm/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz tar zxf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz rm jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz sudo mv ./jdk1.8.0/ /opt/ sudo chown root:root -R /opt/jdk1.8.0/ sudo ln -s /opt/jdk1.8.0/ /opt/jdk8
- Edit
sudo nano -w /etc/profile
and add these lines to the end of file:
PATH="$PATH":/opt/jdk8/bin JAVA_HOME=/opt/jdk8
- Logout and re-login via SSH. Run
java -version
to see if java is working. You should see something like:
java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b36e) Java HotSpot(TM) Client VM (build 25.0-b04, mixed mode)
- Congratulations!