Raspberry Pi - Running Java app on Raspbian

Background

So I installed a fresh copy of Raspbian onto my Raspberry Pi Model B, expanded the file system and all the other stuffs you need to do when you've first set up a Raspberry Pi.

I wanted to use the Raspberry Pi to control my biped robot called Aimie. The method I chose to control my robot was via a serial connection using the io ports on the side of the Raspberry Pi. Trouble is, I developed my Java application on Windows 8.1 and had no idea how to get it working on Raspbian.

Before you start

Before you do anythign with a Raspberry Pi, I recommend you use Bitvise SSH Client, it will allow you to remotely control your Raspberry Pi when you need it. This is very usefull because undoubtbly you will be using the keyboard from your main computer and still have the need to Google things, so a remote connection using SSH really helps.

SSH should be installed and enabled by default, if not use this page.

Use the default login for SSH

Username: pi
Password: raspberry

Update

Run the following commands to update before you continue...

sudo apt-get clean
sudo apt-get update

Check Java version

You can check the Java version on the Raspberry Pi using the following command...

java -version

 Copying files to the Raspberry Pi

By default Bitvise supports sftp which allows you to transfer files to and from your Raspberry Pi whilst you have an open SSH connection. For my project, I used it to transfer my robots AI program. See figure 1.

Figure 1:
SSH SFTP

Note: Bitvise sFTP should open automatically when you first connect to your Pi.

Running your Java application

Browse to the location of your jar using this command...

cd /home/pi/mynewfolder

You should now be able to run your Java app using the following command...

java -jar myfilename.jar

 That's it

Hopefully that helps anyone who get's stuck, if you have any more questions, leave a message in the comments section below.


By Luke Alderton at 30 Jan 2015, 23:22 PM

Tags: Java,Raspberry Pi

Comments

Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Tags
Latest Comments
By dipbleds on Raspberry Pi - Bluetooth using Bluecove on Raspbian
12 Dec 2017, 21:29 PM
By Ich on Replacing the Xamarin Header/Navigation bar with a custom view/template
26 Nov 2017, 17:11 PM
By Ravi Motha on My experience at Umbraco UK Festival 2017
12 Dec 2017, 08:39 AM
By Borges on How to add a Xamarin Forms Loading Screen/Overlay
7 Nov 2017, 19:11 PM
By Rutul Mehta on Auto/Custom height on Xamarin Forms WebView for Android and iOS
4 Nov 2017, 03:15 AM
By Pablo on Xamarin MasterDetailPage has large margin/padding at top
26 Oct 2017, 15:31 PM
By faiza on Using MaryTTS or OpenMary in Java
22 Oct 2017, 12:54 PM
By Nietoperz on Using MaryTTS or OpenMary in Java
29 Sep 2017, 14:34 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development