Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format all Java files in an Eclipse project at one time?

I have an old Eclipse project and the code is not well formatted. I'd like to format all the .java files according to the settings in Eclipse. I don't want to edit every individual file with Ctrl+Shift+F. Is there a way to format all my files? Perhaps an Eclipse plugin?

like image 995
sesamegu Avatar asked Oct 11 '22 19:10

sesamegu


People also ask

Does Eclipse have auto format?

Eclipse has a wonderful feature that formats according to your coding standards.


1 Answers

Right click on the project root and select Source -> Format. This should work for at least version 3.8.1. and above.

If the above does not work, you're probably using an older Eclipse-version. In such case you can select your Source Folders by clicking on them while holding down CTRL, then select Source -> Format from the right-click -menu. Works with package-folders and class files also, in case you don't want to format the entire project.

like image 268
esaj Avatar answered Oct 13 '22 07:10

esaj