Tutorial to install Eclipse (for Java) on the RPI


13 posts
by 3gws » Sat Oct 20, 2012 10:50 am
Hello everybody, I have just received my RPi with 512MB and I want to use eclipse on it I am coming from an Android coding back ground I would like to use Java on the device.
I had a go at installing it last night but it failed I am sure I missed something it seemed that it was unable to find files required over the web to complete it.

As I have only just got the device and have the bare OS installed I can easily start from scratch again.

So if there is anybody out there who can point me in the right direction I would very much appreciate it.
Thanks in advance
3GWS
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am
by xranby » Sat Oct 20, 2012 7:46 pm
3gws wrote:Hello everybody, I have just received my RPi with 512MB and I want to use eclipse on it I am coming from an Android coding back ground I would like to use Java on the device.
I had a go at installing it last night but it failed I am sure I missed something it seemed that it was unable to find files required over the web to complete it.

As I have only just got the device and have the bare OS installed I can easily start from scratch again.

So if there is anybody out there who can point me in the right direction I would very much appreciate it.
Thanks in advance
3GWS


For best out of the box experience, install the Rasbian/Debian built eclipse package by running the following two commands.
sudo apt-get update
sudo apt-get install eclipse
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 401
Joined: Sat Mar 03, 2012 10:02 pm
by 3gws » Sun Oct 21, 2012 12:36 pm
Thanks for that I have installed it and it is very slow to load or do anything with it.

I have nothing else running so it has all of the ram it requires to run.

I appreciate we are ruuning it on a 700mhz Single core processor so my next question is can I use a cross compiler for the R-Pi on a windows PC in the same fashion as Android, is there Raspberry Development Tool like ADT?.

Having an extreamly fast laptop with loads of everything has spoiled me, so waiting 10 mins approx for the IDE to load is going to be its downfnall for me.

Regards

3gws
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am
by savageautomate » Sun Oct 21, 2012 4:45 pm
3gws wrote:Thanks for that I have installed it and it is very slow to load or do anything with it.
I have nothing else running so it has all of the ram it requires to run.

I appreciate we are ruuning it on a 700mhz Single core processor so my next question is can I use a cross compiler for the R-Pi on a windows PC in the same fashion as Android, is there Raspberry Development Tool like ADT?.

Having an extreamly fast laptop with loads of everything has spoiled me, so waiting 10 mins approx for the IDE to load is going to be its downfnall for me.

Regards

3gws


I do all my Java development in Eclipse on a laptop or other computer and then just transfer (SCP) the compiled/packaged JAR down to the Raspberry Pi when I want to run/test it. Since you are using Java, there is no cross-compiler needed. Write once - run anywhere ... and all that ..

If you are interested, check out this open source project: Pi4J.
https://github.com/Pi4J/pi4j/

In this project, I am using Maven to automate the build, package the JAR and then copy the resulting JAR over to the Pi via SCP. It is very fast and once it is copied over, I can just switch to my Putty SSH console and execute the Java program for testing. See the POM.XML files for details on the Maven script.

If you start creating native code for JNI, then you would have to cross compile or compile those parts on the Pi itself. The pi4j-native sub-project is just that and the Maven script is copying all the native C sources to the Pi and carrying out the compilation on the Pi hardware. Eventually I'll switch to a cross-compiler, but this was easy to setup and get started.
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com
User avatar
Posts: 187
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
by savageautomate » Sun Oct 21, 2012 4:50 pm
3gws wrote:Thanks for that I have installed it and it is very slow to load or do anything with it.
I have nothing else running so it has all of the ram it requires to run.
...


Also, if you need to get better Java runtime performance, you may want to switch to the Oracle JDK instead of the OpenJDK.

See comparison benchmarks here:
http://www.savagehomeautomation.com/projects/raspberry-pi-java-virtual-machine-benchmarks.html

Installation instructions for the Oracle JDK 1.7.0u6 here:
http://www.savagehomeautomation.com/projects/raspberry-pi-installing-oracle-java-development-kit-jdk-170u.html

Note, to use the Oracle JDK, you do have to use the Debian "wheezy" (soft-float) distribution on the downloads page and no the Raspbian (hard-float) distribution.
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com
User avatar
Posts: 187
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
by Glollum » Mon Jan 21, 2013 5:16 pm
Note, to use the Oracle JDK, you do have to use the Debian "wheezy" (soft-float) distribution on the downloads page and no the Raspbian (hard-float) distribution.

You can still use the hard-float distro if you install JDK8 from http://jdk8.java.net
R-Pi Model B 512MB
Dell monitor 1280x1024
Raspbian Wheezy
JDK 8 (http://jdk8.java.net)
Posts: 1
Joined: Mon Jan 21, 2013 5:11 pm
by andrei001 » Mon Nov 18, 2013 2:43 am
I installed it via apt-get, but now what? How do I start the program?
Posts: 1
Joined: Mon Nov 18, 2013 2:38 am
by xranby » Mon Nov 18, 2013 10:33 am
andrei001 wrote:I installed it via apt-get, but now what? How do I start the program?


First start the X11 gui after you have logged in.
startx

Inside the graphical user interface locate the eclipse launcher inside the lxde application menu or open a "terminal" window and type
eclipse
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 401
Joined: Sat Mar 03, 2012 10:02 pm
by tobiz » Mon Jan 27, 2014 1:16 pm
I've installed Eclipse on my RasPi after updating to all the latest s/w releases (using Synaptic). Eclipse runs, slowly but what would you expect @ 700Mhz. However if I try to run "Help->Install New Software->Work with All Available Sites" it does run to completion, however if you then try to filter this (I want to install Django) it seems to just hang. Is there an issue here?
Posts: 11
Joined: Tue Mar 20, 2012 2:18 pm
by tobizpi » Tue Feb 11, 2014 10:55 am
To install django on Eclipse you just install PyDev. To install PyDev do Help-->Install New Software, then do Add (by rhs of Work with) put http://pydev.com/updates. Then w a i t, in the box below it will say 'Pending', but eventually a list will appear listing several versions of PyDev for Eclipse. Select one of these, probably best if not the latest and then w a i t again. Then do just as specified and if you're luck you should find PyDev is available under the Window-->Preferences-->PyDev-->Interpreter Python and it should show PyDev in the upper box. If the lower box is empty then press 'Auto Configure' by the upper box and w a i t. Eventually a list of libraries will appear. In the lower box you probably need to enter these two String Substitution Variables "DJANGO_MANAGE_LOCATION" "/manage/" and "DJANGO_SETTINGS_MODULE" "/settings/. Afterwards you may be asked to restart Eclipse. After all this you may be able to do File-->New-->Other--PyDev Django Project. I say may since I've got this far but after this is seems to think django is not installed but I know it is since python import django works. The above sequence works on ubuntu but for some unfathomable reason seems to fall at the last hurdle on RasPI. If anyone knows why then please publish!
Posts: 1
Joined: Tue Feb 11, 2014 10:34 am
by ghatch2 » Tue Jul 22, 2014 7:16 pm
Does anyone know how to have an updated version of Eclipse on the RPi board? I've used the following commands:
sudo apt-get update
sudo apt-get install eclipse

But this gave me a Eclipse 3.8 version and my Windows PC has a more up to date version.
Posts: 11
Joined: Tue Jul 15, 2014 4:07 pm
by riklaunim » Tue Jul 22, 2014 7:35 pm
It would be more handy to do programming remotely and not battle with Eclipse on RPi ;) I got remote Python executable in PyCharm and I can remotely execute code I write from my laptop.
Posts: 195
Joined: Tue Apr 22, 2014 7:34 pm
by ghatch2 » Tue Jul 22, 2014 8:30 pm
So you are suggesting to do it remotely with Python? I know that the RPi board comes with Python (IDLE) on it, but I've heard that a lot of people suggest using Eclipse. My main reason for asking is because I am also using the Rapiro robot (which is designed to be used with the RPi Board)

Note: If you are familiar with Rapiro that when you typing something like this in the terminal:
echo "#M6" | sudo minicom -b 57600 -o -D /dev/ttyAMA0
makes the Rapiro move, but I'm looking for a more solid (save-able) method of coding these type of commands.
Posts: 11
Joined: Tue Jul 15, 2014 4:07 pm