ADC
, for the sample mentionned below.
With the limited amount of RAM available on the Raspberry PI, there is just no way to run modern IDEs on it.
It just does not make any sense.
People develop on another box - with more RAM - and eventually upload the compiled classes on the Raspberry PI, where they can be run.
And that works.
Until you need the debugging capabilities you are used to...
The Java Platform Debugging Architecture (JPDA) makes remote debugging possible.
All you need is to see the Raspberry PI on the network your IDE runs on, as we will demonstrate.
We will show how to achieve this from JDeveloper.
I use JDeveloper for all my PI4J developments, because:
We assume that you have compiled the classes you want to debug from your IDE (JDeveloper in this case), and uploaded the generated classes on the Raspberry PI.
battery.monitor
, modify the line that says:
sudo java -cp $CP adc.sample.BatteryMonitor $*into
sudo java -client -agentlib:jdwp=transport=dt_socket,server=y,address=1044 -cp $CP adc.sample.BatteryMonitor $*Notice the port, it is 1044. You can change that value at your leisure, as long as the port is available.
Prompt> ./battery.monitor Read an ADC Listening for transport dt_socket at address: 1044
Run/Debug
section, and do check the Remote Debugging
box.
Tools Settings | Debugger | Remote
section, and set the host and port appropriately.
raspberrypi
is the name of the Raspberry PI on the network, and that 1044
is the port we used on the Raspberry PI to start the application.
jconsole
is a utility that comes with the Java Devlopment Ket (JDK). It can be used to profile a Java Virtual Machine (JVM) instance, locally, or remotely.
JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote.port=1234 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false \ -Djava.rmi.server.hostname=raspberrypi-boat"The port and the hostname need to match your environment, of course.
jconsole
. It is in JAVA_HOME/bin/jconsole
.
Check the Remote Process radio button, and provide the hostame, and port (1234 in the example above).
Connect
button.
You can now see how the JVM is behaving.