When we create a java binary with bazel, we can run it using a command like this:

bazel run :main

Sometimes an application requires very specific JVM flags to run correctly (For example: -Xmx:512m). These can be set like this:

bazel run :main --jvmopt="-Xmx:512m" 

If we need to set more than one flag, we use this syntax:

bazel run :main --jvmopt="-Xmx:512m" --jvmopt="-Xms:256m"
[ debugging  java  linux  ]
Get arguments used to start a java process
Getting PID for Java Process
Installing Ubuntu on an old computer - Broken graphics
Using lsof to find who is using a file or socket
Advanced top for system diagnosis