In this post we will show how to set up Eclipse to deploy a Java application to a Raspberry Pi located on the local network. We have adapted from this article to reflect fixes to common errors.

Set up Raspberry Pi

  1. Insure that your RPi is connected to your local network and that it has been assigned a permanent IP address. You can do this via your router settings or by modifying the /etc/network/interfaces file in your RPi.
  2. Insure that you RPi has SSH enabled. Goto Preferences—>Raspberry Pi Configuration—>Interfacing Options and select SSH.

Set up eclipse

  1. Install Maven if you have not already. If you do not know what Maven is, take some time to learn before jumping to remote programming!
  2. Enable the Consol View: Window-->Show View-->Consol
  3. Enable the Ant View: Window-->Show View-->Other-->Ant-->Ant

Set up Maven project

If you have not already set up a Maven project, follow instruction (2) of this blog.

Modify pom.xml

Edit the build section of the pom.xml to point to your main class. In the pom.xml below this is <mainClass>pi.hello.App</mainClass>.

Create build.xml file

  1. Right click in the project explorer and click New-->Other-->XML-->XML File
  2. Select project root folder and name file ‘build.xml’

Paste the following into the build.xml file, insuring that the username, password and IP address of your pi is correct.

Run the ant file

Right click on build.xml and click on Run As-->Ant Build. If everything is set up and working, your output should look like the following:

Issues and Resolutions

Maven Build Issue

If you get the following error:

CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.codehaus.plexus:plexus-utils:jar:1.1 has not been downloaded from it before.

Resolve by deleting the Maven folder org.apache.maven.plugins:maven-compiler-plugin:3.1

This is located in the folder ~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin:/3.1

If you do not see the hidden folder .m2 on your Mac, enable viewing of hidden folders.

Ant Dependency Issues

If you get the following error…

create a lib folder, and put this jar in it: https://search.maven.org/artifact/org.apache.maven/maven-ant-tasks/2.1.3/jar

If you get this error…

Download the dependent jar from here: https://sourceforge.net/projects/jsch/

And place into your project lib folder. If you do not have a lib folder, create one in the project root directory.

Go into the Eclipse Preferences-->Ant/Runtime entry-->'Classpath' tab and use the button Add External Jars to add your jsch.jar to Ant’s classpath.

Are you interested in the cutting edge of AI processors? Read how to build the Ex-Machina Wetware Brain and learn about the Knowm Technology Stack.

Related Posts

Subscribe To Our Newsletter

Join our low volume mailing list to receive the latest news and updates from our team.

3 Comments

Leave a Reply to Pétur Ingi Cancel reply

Knowm 32X32 Crossbar

Knowm Newsletter

Are you ready for memristor AI processors? With our newsletter, you will be.