java system - How can I get eclipse to wrap lines after a period instead of before

implement details (4)

I've looked throughout Preferences -> Java -> Code Style -> Formatter and can't find any way to get eclipse to format my code like:


Instead of:


I know that's non-standard, but that's what I need.

Edit: This is not about getting lines to wrap. It's specifically about where the wrap happens in relation to the period. I want the period at the end of the line, before the newline and right now eclipse wants the period at the start of the next line.

Edit2: Even if I could find out where eclipse's source code it decides where to wrap the line, that might help. I think it might be in the JDT project, but I'm not 100% and there's a lot in there.


First of all, I don't think there is a way to get the standard Eclipse Java code formatter break lines after a . ... apart from modifying the formatter code itself. (And that means you are not running the standard formatter anymore!)

All is not lost. I did a Google search for "eclipse formatter plugin", and came across a link to the Jindent plugin in the Eclipse Marketplace. Digging a bit further, I found the documentation for the Jindent Formatter Settings. According to " Method Calls", Jindent can be told to break lines after a "." rather than before one.

So ... if you are prepared to pay for a Jindent license, you can get an Eclipse plugin for it for free that will indent your Java code the way that you prefer.


  • Jindent is a commercial product. You will need to pay for a license.
  • I have never used it, so this is not a recommendation or endorsement.
  • I have no association with the company or people who provide this product.

Current Java style guides recommend that you break lines before . symbols, operators and so on. I would advise that you learn to live with the "standard" style ... because that is what other people who read your code are most likely to be expecting.


Try this.

Window > Preferences > Java > Code Style > Formatter > Edit > Line wrapping > Function Calls, set the 'Line wrapping policy' as 'Wrap all elements, every element on a new line'.

If found already then cool.

I think if you install the eclipse java mars which is the new version of eclipse, your problem would be solved. I am saying that because I am using the newest version and I am not facing this problem. Sorry again if I could not help I am still a beginner

Preferences > Java > Code Style > Formatter > Line Wrapping > Binary Expressions > Wrap before Operator

The above controls where + is placed. (Though it should never be on a its own line)

java eclipse word-wrap formatter