Search code examples
javaeclipsecomments

How to disable the automatic asterisk (inserting stars) in Eclipse when adding a multi-line comment?


When adding a multi-line comment in Eclipse and format it(Ctrl+Shift+F), it automatically places an asterisk (*) at the beginning of each new line inside the comment block.

/*
 * this is my comment
 */

What is the reason of this behavior?

How can I disable it?


Solution

  • In Eclipse 4.2 and later, the solution is: Window -> Preferences -> Java -> Code Style -> Formatter ->

    $profileName -> Edit... () -> comments ->* un-check [ ] Enable block comment formatting.

    Note that the author asked for block comments (/*) and not for Javadoc comments (/**).

    To supress leading * for Javadoc comments un-check [ ] Enable Javadoc comment formatting


    (*) If $profileName -> Edit... doesn't work, create a new template using "New...".

    See image highlighted in yello