How to pass :jvm-opts to clj from terminal?

The -O flag is used to pass alias names, not options. So one choice is to create an alias:

:aliases {:xb {:jvm-opts ["–add-modules java.xml.bind"]}}

then activate the alias at the command line:

clj -O:xb ...etc...

Or you can supply jvm options directly in the command line with -J:

clj -J–add-modules java.xml.bind ...etc...

2 Likes