Passing Arguments To a Java Binary Ran With Bazel
When we create a java binary with bazel, we can run it using a command like this:
1
bazel run :main
Sometimes an application requires very specific JVM flags to run correctly (For example: -Xmx:512m
). These can be set like this:
1
bazel run :main --jvmopt="-Xmx:512m"
If we need to set more than one flag, we use this syntax:
1
bazel run :main --jvmopt="-Xmx:512m" --jvmopt="-Xms:256m"