Running Java IoT Applications outside of the Intel System Studio IoT Edition

By Promotion | Updated 2 Jun 2017
Running Java IoT Applications outside of the Intel System Studio IoT Edition

This section contains steps to run Java* Internet of Things applications on an Intel® Edison board or Intel® Galileo board outside of the Intel® System Studio IoT Edition.


Building Java* IoT applications

You can run Java IoT applications outside of the Intel System Studio IoT Edition by manually compiling the code using javac. For compilation, you need the .jar files corresponding to the MRAA* and UPM* libraries on the device. An archive with the latest stable libraries can be found in (the development versions of the UPM and MRAA .jar files can be found here. In the commands below, the following locations and names are used:

  • PATH_TO_JARS represents the location where the archive with the .jar files has been unpacked.
  • PATH_TO_SOURCE_FILES represents the path to the Java source files.
  • bin/ is the directory where the compiled Java classes are placed.
  • NAME_OF_JAR_FILE is the name given to the .jar file where the compiled Java classes are placed.
  • NAME_OF_MAIN_CLASS is the name of the class that contains the main() method, which is the entry point of the application.

1. Use the following commands to compile and pack the Java files of the IoT Java application:
jar cvf NAME_OF_JAR_FILE -C bin/ .


2. Copy the resulting application .jar file (NAME_OF_JAR_FILE) to your Intel® Edison or Intel® Galileo board. On a system with Linux* or OS® X, you can use scp. On a system with Windows*, you can use WinSCP.

For example, assuming your application is in a source file placed in C:\workspace\sample\src\(PATH_TO_SOURCE_FILES) and the IoTDK .jar files are in C:\upm (PATH_TO_JARS):


3. Copy the files to the board using scp for Linux or OS X, or WinSCP for Windows:

Running Java IoT applications on IoT devices


In the IoTDK device images, the .jar files needed on runtime for using MRAA and UPM are located in/usr/lib/java. The Java shared libraries are located in /usr/lib, the default path for shared libraries on Linux systems. Therefore, setting the java.library.path with the “-Djava.library.path=/usr/lib” parameter is not necessary.

1. To run your Java application on the target device with the MRAA and UPM libraries, use the following command:
java -cp .:/usr/lib/java/*:NAME_OF_JAR_FILE NAME_OF_MAIN_CLASS
In the example application below, you you would type:
java -cp .:/usr/lib/java/*:sample.jar Sample
2. Connect to the board using ssh or PuTTY and run your application. In the sample application above, you would run the Sample class in the sample.jar file. You can view the output in your terminal window, as shown below:


For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone



Recent Questions

How to Start with Internet of Things ( IoT ) ?
Nishit Bavishi
Aug 5, 2015
Be the first one to post the comment
Post a New Comment
You must be signed in to post a comment