Get a JDK:
Then you have all the familiar JRE and JDK tools, like java, javac, jar, etc. If you are able to install, but there is a dependency error, try to install all of the individual packages:
It might be that your particular distribution don't have those packages in the package list. In that case: URLs in required installation order:
Download the newest version for armv7a (or all) architecture, example:
Install using: opkg install <filename> Test: root@beaglebone:/usr/src/javatest# cat HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } } root@beaglebone:/usr/src/javatest# javac HelloWorld.java root@beaglebone:/usr/src/javatest# java HelloWorld Hello World! root@beaglebone:/usr/src/javatest#
Eclipse IDEIf you want to use Eclipse on your PC to do development, one way to do that is to use the Eclipse Remote System Explorer. Project setup, editing and buildingIf it is not already installed on your Eclipse, you can get it under "Install new software" and searching for "Remote System Explorer" and "Remote System User Actions". When Remote System Explorer is install, open the Remote System Explorer Perspective. In the tab "Remote System Details", right click, and select "New" -> "Connection" Type in the hostname / IP address of your BeagleBone. Use SSH for all settings. Create a folder where you want to have the project files, e.g. "My Home/dev/myproject" On that folder, right-click and select "Create Remote Project": Switch back to Java perspective to see the new project. On the project, right-click and select properties Under "Project Facets", click the "Convert to faceted form.." link: Select the Java Facet, and the appropriate version (e.g. 1.6): You can now start adding classes and building the project like a normal Java project. The source will sit on the remote system, the local computer will do the build, and the output is stored back to the device (defaults to build/classes under your project directory). Remote debuggingStart the program on the device, either directly in a terminal window, or through the "Remote system explorer". Add the following parameters to listen for a remote debugger: java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 -cp build/classes net.cameon.automation.control.Control As we have here set the "suspend=y", the program will wait for the debugger to attach before starting to run. Inside Eclipse, right click on the class to debug, and select "Debug as " -> "Debug Configurations...". Select "Remote Java Application", and type in the IP and port of the remote device. The port is the same as we set on the command line previously: Click Debug to start debugging. Accessing Serial ports from JavaOne way to access the serial ports from Java on the BeagleBone, is to use the RxTx library. Install both the native part and the Java glue library:
Then you can program using RxTx on the BeagleBone as you would on any other system. and then run the program with a command that specified both the path to the rxtx.jar and the serial native library (.so) files:
The built-in serial ports on the BeagleBone isn't autmatically detected by RxTx. To add them to the list of available ports, set the "gnu.io.rxtx.SerialPorts" property to a colon-separated list of port names. You can do that in a property file, or directly on the command line: java -Dgnu.io.rxtx.SerialPorts=/dev/ttyO0:/dev/ttyO1:/dev/ttyO2:/dev/ttyO3:/dev/ttyO4:/dev/ttyO5 -Djava.library.path=/usr/lib/jni/ -cp .:/usr/share/java/rxtx.jar CommTest |
Using the BeagleBone >