Skip to content

in idea 2022.3.3, this plugin throw error : configure the jre for google-java-format #940

Closed

Description

@git-code-for-me

the configure is not work, in idea 2022.3.3

--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED

--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

Activity

  1. andskiba commented on May 19, 2023

    @andskiba

    @git-code-for-me I had the exact same problem today. Apparently it's very important that you put a newline at the end of you .vmoptions file otherwise the last option gets concatenated with some other options that idea is adding.

  2. added a commit that references this issue on Jul 4, 2023
    c2e19cb
  3. malopez16 commented on Jul 27, 2023

    @malopez16

    adding new line doesn't work for me.

  4. evilmilo commented on Nov 2, 2023

    @evilmilo

    I've having same issue, idea 2023.2.4
    Running on intel mac.
    openjdk version "17.0.9" 2023-10-17

    Keep getting the popup every time start IDE saying to configure the jre for google-java-format

    Formatting doesn't work at all. The preview window in Code Style doesn't update with config changes.

    Checked idea.log , and can't see anything to explain why this isn't loading, not errors or warning, just single line saying loaded plugin:

    2023-11-02 08:56:58,416 [ 241] INFO - #c.i.i.p.PluginManager - Loaded custom plugins: google-java-format (1.17.0.0), Save Actions - XDEV Edition (1.0.4)

    idea.vmoptions

    -Xmx2048m
    --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
    --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
    

    Is there anywhere else to get logs or diagnostics on why this plugin isn't loading properly?

  5. plumpy commented on Nov 2, 2023

    @plumpy
    Collaborator

    Can you see if those options are actually being applied to the JVM? For example, if you do a ps auxw | grep idea.Main, do you see those options (all six of them) being passed to the JVM?

    (Sorry, I don't have a Mac, so I don't know if ps auxw actually works there, but I think it should...)

  6. evilmilo commented on Nov 2, 2023

    @evilmilo
    % ps auxw | grep idea.Main
    nathan.mcdonald  25041   0.5  0.0 34130588    740 s009  S+    2:01pm   0:00.01 grep idea.Main
    
  7. evilmilo commented on Nov 2, 2023

    @evilmilo

    So looks like issue with intellij on mac, not the plugin (not picking up vm options).

    Instead, I editted:
    /Applications/IntelliJ\ IDEA\ CE.app/Contents/Info.plist

    Found this section:

    <key>JVMVersion</key>
          <string>1.8*,1.8+</string>
          <key>MainClass</key>
          <string>com/intellij/idea/Main</string>
          <key>ErrorFile</key>
          <string>-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log</string>
          <key>HeapDump</key>
          <string>-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof</string>
          <key>Options</key>
          <array>
            <string>--add-opens=java.base/java.io=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.lang=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.lang.ref=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.lang.reflect=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.net=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.nio=ALL-UNNAMED</string>
            <string>--add-opens=java.base/java.nio.charset=ALL-UNNAMED</string>
           ....
    

    and at the end of that array, added the other strings

            <string>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</string>
            <string>--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</string>
            <string>--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</string>
            <string>--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</string>
    

    Restarted, and now works as expected!

  8. evilmilo commented on Nov 2, 2023

    @evilmilo

    Hmm... so raised with Intellij, but they said vm options are loading correctly, so maybe issue with plugin not picking up options correctly?

    https://youtrack.jetbrains.com/issue/IDEA-337068/Custom-VM-Options...-are-not-being-applied-when-running-on-Mac

  9. cushon commented on Oct 29, 2026

    @cushon
    Collaborator

    Current releases of the IntelliJ plugin target IntelliJ 2025.1+ (which bundles JBR 21) and configure the required JVM exports automatically when installed from the JetBrains Marketplace: https://github.com/google/google-java-format#intellij-android-studio-and-other-jetbrains-ides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions