Tuesday, December 17, 2013

Develop Java application in Windows, run in Raspberry Pi.

This post show Java application developed jar in Windows using Netbeans IDE, can be run on both Windows and Raspberry Pi.

Java jar run on Windows and Raspberry Pi
Java jar run on Windows and Raspberry Pi
Both Raspberry Pi and Windows 8.1 have the same JDK™ 8 Early Access Releases installed; JDK for Windows 32-bit on Windows, JDK of Linux ARMv6/7 VFP, HardFP ABI on Raspberry Pi.

demo video:

The code used here as a example can be found in "List system properties using java",  to list available system properties.

- Start Netbeans IDE in Windows, new a Java Application.

- Make sure it target the same Java platform running in Pi side. Right click on Project > Properties > Category of Libraries > Select Java Platform of JDK 1.8.

- Edit, and build your application.

- To know where is the generated jar, click Run > Clean and Build. The generated jar wil be in "Created dir: <...>\JavaTest\dist".

- Copy the generated jar, JavaTest.jar, to Raspberry Pi.

- Run it in Raspberry Pi side by enter:
java -jar JavaTest.jar

- Remote run Java on Raspberry Pi, host from NetBeans on Windows 10

No comments: