MangoHud and Java
A little tip to launch Java programs directly from your IDE using MangoHud
MangoHud is an overlay for monitoring frame rates, frame times, temperatures and CPU/GPU loads on Vulkan and OpenGL applications in Linux. It is also the default performance overlay used in the Steam Deck, and it is awesome.
I know the amount of people using Java for high performance graphics is not very high, but they are there, of that I’m sure. I’m actually one of them. Gaia Sky is written in Java, and even though it has its own rudimentary debug overlay, MangoHud goesfar beyond it. When I’m not editing in neovim, I use IntelliJ IDEA CE to do a little refactoring and deubgging. It is during these times that being able to run the JVM with MangoHud directly from the IDE comes in handy. But most IDEs do not allow customizing the launch command directly to use the
mangohud /path/to/app approach, so how do we do it?
It turns out we just need to set one single environment variable to inject the necessary libraries. To that effect, we just need to locate the location of the MangoHud library in our system (
/usr/lib/mangohud in ArchLinux), and point the variable
$LD_PRELOAD to the files
libMangoHud_dlsym.so, like so:
You can do that from the run configuration dialog in IDEA or Eclipse. Look for a section or text feield that reads “environment variables”.
Here is how to do it in IDEA: