I am new with raspberry pi. Actually I am coming from Java background. Which programming should I use for raspberry pi tasks? The choices are given below:-

  • Java
  • Python

Kindly suggest me which one of them should I choose?


This is largely a matter of opinion; these are two different languages with their own strengths and weaknesses.

That said, the rpi community seems very partial to python, and so you have various python libraries for doing pi (or: linux based GPIO dev board) specific things. If you are interested in connecting I2C devices from retailers like adafruit, there is often python helper code and corresponding tutorials.

However, you don't actually need python to do any of that. The I2C interface is a native C API (and very very simple), so if you know C, you could incorporate than into Java via the JNI, which someone else has already done (so if you don't know C, you should be able to use that).

As explained here the GPIO interface uses file nodes and is therefore in fact language agnostic: other than basic I/O, you don't need any additional libraries at all.

So there's nothing you can do in python in the pi that you can't do in java as well. My personal suggestion, if you don't already know one of the big 3 "dynamically typed object oriented" languages -- python, perl, and ruby1 -- is to try one. Java is great, but dynamic typing is a very interesting contrast and knowing one of those (my own preference is perl) is definitely worthwhile.

1 To be fair PHP should round that out to four, since it can be used in a general purpose way and not just for web-dev. Javascript fits in with these too, but still isn't used much as a general purpose language and the possibilities for such are more limited.

  • Actually my first task is to take a print from printer device through raspberry pi?
    – Zeb
    Dec 4 '13 at 17:50
  • Programmatic access to the printer is either via a device node or an existing external application, so again, any language is fine.
    – goldilocks
    Dec 4 '13 at 17:55
  • If I pick python which editor should I use? Because I attach my raspberry pi with my laptop through remote connection. I only work by using terminal.
    – Zeb
    Dec 4 '13 at 18:04
  • If you're connecting remotely, you could set up file sharing and use whatever editor you want on the laptop. If you want to do it directly through a non GUI terminal, there's vim and emacs which can do most of what an IDE can, but they are not easy to learn, lol. Then there's nano, which is extremely simple, but doesn't do much beyond syntax highlighting. Give that a try and if it isn't good enough, look for a tutorial on one of the other two.
    – goldilocks
    Dec 4 '13 at 18:15
  • OK I select Python language and start learning from know :) Thanks for help
    – Zeb
    Dec 4 '13 at 18:40

I would suggest you to use python.As far as I experienced there is a lot of help and experiments available in python .

  • You know java ,so first give it a try on Raspberry!
    – Maham Khan
    Dec 4 '13 at 17:28
  • I know Java but I'm little bit confuse in that may python have strong libraries or APIs than Java or maybe vise versa.
    – Zeb
    Dec 4 '13 at 17:44

oracle has Java available for the raspberry, but if you want to develop on the machine itself you do not have any if the major IDEs available and the machine would have too little ram anyway.

So, go for python.

  • Yes you right , there is also problem of little RAM.
    – Zeb
    Dec 4 '13 at 21:36

I have been programming for more than 40 years, and while c(and its successors) is my preferred language, since getting a Pi I have been using Python. If you know java this should not be too different, but I can recommend "Learning Python" 5th Edition.

You also asked about editors. The Pi has IDLE, which is a Python IDE. I strongly recommend Geany, which is easy to use.

Both of these are GUI, so if you are developing remotely you should use VNC (install tightvncserver on the Pi).

You don't mention what laptop you are using, but Mac, Windows and Linux all have support, but details differ.

  • I follow the process of installing tightvncserver and xtightvncviewer on raspberry pi. Than I edit a configuration file by using nano tightvnc.desktop and write following lines:[Desktop Entry] Type=Application Name=TightVNC Exec=vncserver :1 StartupNotify=false then after restart desktop not appear on my laptop??
    – Zeb
    Dec 5 '13 at 14:25
  • you don't need xtightvncviewer (but it won't hurt) What is your laptop, and how are you trying to view VNC on it
    – Milliways
    Dec 5 '13 at 23:22
  • I have Lenovo B570 using version Ubuntu 13.04 , First I attach my raspberry pi to laptop through Ethernet cable. When I write by using terminal: zeb@zeb-Lenovo-B570:~$ ssh pi@ Then I switch to raspberry pi terminal like: raspberrypi:~$ . I follow the instruction from Learn2Crack
    – Zeb
    Dec 7 '13 at 17:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.