Chris Wade

Chris developed much of the Forms handling code and also the hooks for the XFA.

Writing cleaner Java code with eclipse

1 min read

It is always helpful when a tool encourages you to write ‘good code’. Eclipse has some excellent plugins like PMD and FindBugs for analysing and improving your code. But did you know that Eclipse actually has some useful built-in tools to help you?

I found a useful feature of eclipse, to help me clean up my code before I test or commit any of it.
If you go to ‘Window’ -> ‘Preferences’

I’m sure you have been in here before,
But now go to ‘Java -> ‘Compiler’ -> ‘Errors/Warnings’

Now there are lots of useful clean code building features you can edit.


I use the Unused imports and local variables unread, as many times writing new code you add variables that you later end up not needing. This is a good way to highlight them to you. You can also set the options to show a warning or fail – so that your code will not compile and Eclipse will show an error. You will then have to actually fix the issue then and there.

It also allows you to turn all those annoying warnings off so that you can see the errors in the right side bar of your code display window (those blue and yellow, and sometimes red, square markers).

If you turn them all on, you will probably see loads of errors or warnings. So if you are new, a good strategy is to turn them on individually over a period of time and deal with the issues over a period of time. This also lets you test your changes gradually and reduces the chances of breaking something. It is a good end of day 15 minute task.

Do you have any favourite features that help you in developing your code?

Chris Wade

Chris developed much of the Forms handling code and also the hooks for the XFA.

The top 11 Free IDE for Java Coding, Development…

At IDR Solutions we spend a lot of our time working with Java as our Java PDF Library, Online Document Viewer and Java Image...
Alex Marshall
6 min read

9 tools to help you with Java Performance Tuning

Previously I wrote an article about 5 tools to help you write better java code which helped to improve our code but also our...
Alex Marshall
4 min read

5 tools to help you write better Java Code

At IDR Solutions we are always looking at ways to improve our Java PDF Library and our PDF to HTML5 Converter. The best way...
Alex Marshall
3 min read

Leave a Reply

Your email address will not be published. Required fields are marked *