1

I'm currently using eclipse Mars and I'm trying to figure out how to enable word wrap so that when my lines are too long, it can go down to the next line. I tried going to

Preferences > Java > Code Style > Formatter

and I created a new eclipse profile then set the maximum line width to 50 under the 'line wrapping' tab. I applied the feature and clicked 'Ok'. I tried to test if it worked by writing a really long line of code and it still didn't wrap. What am I doing wrong?

Cyborg 3.0
  • 19
  • 4
  • Just apply the format to a file or files, look at this for hotkeys: http://stackoverflow.com/questions/15655126/how-to-auto-format-code-in-eclipse – Anton Malyshev Aug 05 '16 at 15:25
  • did you actually applied the format, or just defined it? (50? I hope that was a test value?) – njzk2 Aug 05 '16 at 15:33
  • If you could add a screenshot of your `Line Wrapping` tab that would help. Also make sure you set `Line Wrapping Policy` to a policy other than `Do not wrap` – SomeDude Aug 05 '16 at 15:46
  • I did apply the format and set the Line wrapping policy to 'Wrap where necessary'. It still doesn't wrap the way I want it to. Do I need to set the maximum line width to a lower number? – Cyborg 3.0 Aug 05 '16 at 15:57
  • Are you actually running the formatter (Source > Format)? – greg-449 Aug 05 '16 at 16:10
  • I have defined maximum line length as 120, and when i apply formatting, I do not see the line wrap. Does any one have solution for this? – Satya P Mar 08 '18 at 11:08
  • Strangely, it seems like line wrap max length is a bug in **Eclipse Oxygen**. I tried to apply line wrap in **Eclipse Neon 3**, and its working fine :O – Satya P Mar 08 '18 at 11:23

0 Answers0