In Eclipse, I can press Alt+Shift+J and get a javadoc comment automatically generated with fields, returns, or whatever would be applicable for that specific javadoc comment. I'm assuming that IntelliJ IDEA has this feature. Can anyone tell me if there is a keyboard shortcut for this?
Asked
Active
Viewed 1.9e+01k times
3 Answers
380
Typing /**
+ then pressing Enter above a method signature will create Javadoc stubs for you.

Jared Burrows
- 54,294
- 25
- 151
- 185

Rachel Gallen
- 27,943
- 21
- 72
- 81
-
3When overriding a method, eclipse adds an @see tag with a link to the parent method. Can IntelliJ do the same? – Καrτhικ Dec 01 '14 at 18:28
-
4@RachelGallen link is dead, see [jetbrains.com/help/idea/creating-documentation-comments.html](https://www.jetbrains.com/help/idea/creating-documentation-comments.html) – boardtc Nov 21 '18 at 14:24
-
1@boardtc thanks for the update. I actually tried to revisit the link recently and the whole site was down. Nice one. – Rachel Gallen Nov 21 '18 at 14:28
-
5this seem to only create the comment block, no actual stub – Ghilteras Jun 11 '19 at 00:06
97
You can use the action 'Fix doc comment'. It doesn't have a default shortcut, but you can assign the Alt+Shift+J shortcut to it in the Keymap, because this shortcut isn't used for anything else.
By default, you can also press Ctrl+Shift+A two times and begin typing Fix doc comment
in order to find the action.
-
9For anyone else searching for how to get IntelliJ to update javadoc after a code change, you can set this in Settings -> IDE Settings -> Keymap. – Mark McDonald Oct 09 '13 at 01:50
-
-
@StealthRabbi "Help -> Find Action" and type "fix d" (or the "Ctrl + Shift + A" mentioned in the answer, unless you remapped it). – Ped7g Aug 17 '17 at 14:11
-
1Do I have to select something? Even if I select the whole file content or select nothing, nothing happens if I run this action. May I am missing something – Honsa Stunna Jun 18 '19 at 11:46
-
3@Honsa Stunna we have to exactly click the method line and go for action. – Mukundhan Aug 10 '19 at 11:10
-
1
42
Shortcut Alt+Enter shows intention actions where you can choose "Add Javadoc".

Robert Jakubowski
- 630
- 8
- 16
-
2I think that 3 could disagree with that statement. You should set pointer on the name. – Robert Jakubowski Mar 16 '17 at 13:05
-
5put the cursor on the method name you want to add javadoc ,and then press alt + enter, there will be an add javadoc option in the popup.If the method already has a javadoc,then there will be no add javadoc option. – lin Jun 12 '17 at 03:11
-
2The only confusion I saw is people asking to put the cursor in function/class/variable to generate java docs. You have to keep the cursor on the object for which you are generating the documentation, just the way you will import a class by keeping cursor on the object and hit `Alt`+`Enter` – Doogle Feb 02 '19 at 14:15
-
Getting to the intention is fine and all, but the goal is - what keymap can I use to add the comment without having to do extra stuff, thus the answer above - adding the keymapping to "Fix doc comment" is the correct answer for someone coming from Eclipse – Charles Hasegawa Aug 13 '21 at 18:55
-
@user1742058 Yes, you're right, but there are many people that found that answer helpful. Furthermore, The accepted answer is also not a shortcut. I think that all 3 answers are good and everyone could pick one. – Robert Jakubowski Aug 23 '21 at 11:08