Search code examples
javaintellij-ideaidecommand-line-arguments

How to pass command-line arguments to IntelliJ itself, to alter behavior of IDE (not my own app within IDE)?


I want to try using the new new Metal-based rendering pipeline on macOS for Java 17, as explained in JEP 382: New macOS Rendering Pipeline. The new feature is not enabled by default. To switch from the default (OpenGL) to the new feature (Metal), one must supply the JVM with command-line arguments upon launch:

-Dsun.java2d.metal=true

I would like try running IntelliJ under Metal rather than OpenGL. So I need to convince IntelliJ to (a) Use Java 17, and (b) pass that argument to the JVM driving its own operations.

I understand that IntelliJ runs on its own internally-bundled JVM rather than the JVM installed on my Mac. So:

  • How do I know the version of the JVM being used by IntelliJ?
  • Can I point IntelliJ towards another JVM for its own operations, for a later version of 17 (understanding that I am operating IntelliJ in an untested and unsupported environment)?
  • How do I pass a command-line argument to that JVM when IntelliJ is launching?

I am using IntelliJ IDEA 2021.2.2 (Ultimate Edition) on macOS Big Sur on MacBook Pro with Apple Silicon (M1 chip).


I am not asking about how to pass command-line arguments to an app being developed within IntelliJ. So I am not asking about how to use the Run/Debug Configurations feature of IntelliJ. That topic has been asked and answered many times already on Stack Overflow.


Solution

  • How do I know the version of the JVM being used by IntelliJ?

    You can find that in the 'about' dialog:

    about dialog

    Can I point IntelliJ towards another JVM for its own operations, for a later version of 17 (understanding that I am operating IntelliJ in an untested and unsupported environment)?

    Technically you can, but it might cause problems in your IDE I think? There's a warning in their documentation, see Change the boot Java runtime of the IDE to switch to a custom JDK.

    How do I pass a command-line argument to that JVM when IntelliJ is launching?

    Once your IDE is running, go to Help > Edit Custom VM options, see their Advanced configuration page.