Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
git-code-for-me opened this issue May 17, 2023 · 7 comments
Labels

Comments

@git-code-for-me
Copy link

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

@andskiba
Copy link

@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.

paulwwisl added a commit to paulwwisl/google-java-format that referenced this issue Jul 4, 2023
@malopez16
Copy link

adding new line doesn't work for me.

@evilmilo
Copy link

evilmilo commented Nov 2, 2023

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?

@plumpy
Copy link
Collaborator

plumpy commented Nov 2, 2023

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...)

@evilmilo
Copy link

evilmilo commented Nov 2, 2023

% ps auxw | grep idea.Main
nathan.mcdonald  25041   0.5  0.0 34130588    740 s009  S+    2:01pm   0:00.01 grep idea.Main

@evilmilo
Copy link

evilmilo commented Nov 2, 2023

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!

@evilmilo
Copy link

evilmilo commented Nov 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants