How to pass JVM parameters to the roboRIO?

I am trying to attach a VisualVM profiler to the roboRIO with some success. I want to be able to modify the file to pass the JVM parameters down to the roboRIO so I can attach it via JMX.

I haven’t been able to find any such documentation. Can anyone help with this?

Easiest way to do that is with the build.gradle file:

Look at lines 31-38, those will be the only ones needed to use VisualVM

Wow! Thanks for the quick response! I have a follow-up question. Are you able to maintain a stable connection to the robot? I was working with a testbench that has a roboRIO, radio, PDP, the basic brain, and was unable to get a reliable connection. It would fail, fail, connect!, then work.

On an actual robot I wasn’t able to connect at all. Have you had any problems like that?

I don’t recall it causing connectivity issues.
It would sometimes complain that the 1099 port is taken so I disabled it whenever I wasn’t using it.
Do you want to send the DS logs for us too look over?

thanks, I will do that. I am not at the lab right now, but I will generate and capture the logs. Perhaps your method of passing the parameters in will work better than me editing the startup script in /home/lvuser.

I didn’t have any success when modifying the build.gradle or other commonplaces on the system, lmk if you do! I will post my modifications to the startup script here in a second.

A question about the parameters you are passing:

// jvmArgs.add(“”)

looking at the JMX docs I see this:

Enables the JMX remote agent and local monitoring via a JMX connector published on a private interface used by JConsole and any other local JMX clients that use the Attach API. JConsole can use this connector if it is started by the same user as the user that started the agent. No password or access files are checked for requests coming via this connector.

true / false. Default is true.

I interpret your statement to be disabling jmxremote. I am focusing on this statement because I don’t have this argument in my setup.

Yeah you’re totally right, I accidentally left it in when trying to disable it without commenting out the whole thing, it should be set to true.
The original code is not by me actually, this is the source:


The parameters I passed which worked a few weeks ago is this. 

Then connect using rmi port 1099 which is very similar but missing the line

A team has made a nice guide for beginners here.

Their 2023 repository shows how to do it in build.gradle without modifying shell scripts.

This really needs to be added to wpilib docs somewhere. I gave up on trying to figure out how to do it in gradle after a few hours. Thank you!

An issue was recently opened. Add page explaining how to use VisualVM on the RIO · Issue #2229 · wpilibsuite/frc-docs · GitHub