google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

IntelliJ plugin not working

Open tstewart15 opened this issue 1 year ago • 4 comments

Summary

Following the instructions, I'm unable to get the formatter plugin to work.

Details

I've completed all steps in the instructions:

  1. Installed plugin

  2. Enabled the plugin in "Settings -> Other Settings -> google-java-format Settings": image

  3. Updated the configs in "Help > Edit Custom VM Options...": image

  4. Restarted the IDE

But I still get the following error when attempting to run "Reformat code" command: image

Environment

  • Plugin version: 1.22.0.0 image

  • IntelliJ version: IntelliJ IDEA 2024.1.3 (Ultimate Edition)

tstewart15 avatar Aug 06 '24 00:08 tstewart15

@tstewart15 the config options look right to me.

Does your configured project JDK have the required classes? Listed below. https://github.com/google/google-java-format/blob/ebf9b52314d7adddeae4add42a1757f30c87c5d6/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/JreConfigurationChecker.java#L54-L59

You might be able to check your idea.log file for the below log message. It should indicate which class is missing (if any). https://github.com/google/google-java-format/blob/ebf9b52314d7adddeae4add42a1757f30c87c5d6/idea_plugin/src/main/java/com/google/googlejavaformat/intellij/JreConfigurationChecker.java#L61

nrayburn-tech avatar Aug 21 '24 03:08 nrayburn-tech

Sorry looks like I misunderstood which JDK is used for the extension. You’ll want to check if the boot JDK has the required classes. Some info on that here, https://www.jetbrains.com/help/idea/switching-boot-jdk.html.

nrayburn-tech avatar Aug 21 '24 23:08 nrayburn-tech

Thanks @nrayburn-tech sorry for the delay.

I tailed the idea.log file while disabling then reenabling the plugin, as well as quitting then restarting IDEA, but did not find any error messages mentioning "google-java-format".

I did find an info log which mentions the JRE used by IDEA during boot (I think):

2024-10-08 22:37:52,570 [     65]   INFO - #c.i.p.i.b.AppStarter - JRE: 17.0.11+1-b1207.24, aarch64 (JetBrains s.r.o.)

Any ideas on next steps to investigate?

tstewart15 avatar Oct 09 '24 05:10 tstewart15

I have same problem, the plugin is never made available for use in IntelliJ.

dhoffer avatar Mar 07 '25 23:03 dhoffer