What is the use of java utilities


26.6 Other utilities


26.6.1 Source code beautifier

A source code beautifier has the task of making source code more readable and therefore more maintenance-friendly while maintaining the logical structure. The possibilities offered by a beautifier are, for example:

  • intelligent indentation of the source code with tabs or spaces and end-of-paragraph characters
  • Handle the curly braces consistently. Different schools propagate very different ideas about where to put the curly brackets in the source text.
  • Formatting the comments in a consistent format
  • Automatic generation of JavaDoc instructions. What emerges from the source text can be automatically translated into a documentation comment.
  • Inserting header and footer templates
  • Processing in the batch process
  • Some products offer an open API so that they can be used as a library for their own programs. This is useful for programs that generate Java source code, such as parser generators or the UML based on Java programs. The software can then be relieved and does not have to worry about indenting the generated source code.

Some programs are now preparing to meet these requirements. First of all, there is the formatter in Eclipse. It can be configured in many ways, and a format style should be identified and used in a team. Because the rules can be exported in XML, they are easy to distribute.

The keyboard shortcut Ctrl + Shift + F formats the entire document. If a section is marked, Eclipse only formats this.

Other programs:

  • Jalopy is under a BSD license and is available at http://jalopy.sourceforge.net/. It can be used via the console or Ant and integrated as a plug-in in Eclipse, JDeveloper or NetBeans.
  • Jindent at http://www.jindent.com/ is a commercial product, but there is also a free version. The product is very professional and allows very fine adjustment of the output via configuration files. In addition, the program can also prepare the source code for websites or presentations.

26.6.2 Run Java programs as a system service

A so-called service can be set up under Windows and Unix in order to run programs immediately when the system is started. This allows the operating system to run programs - such as a Tomcat server - in the background without a user having to be logged on.

The standard installation does not include the ability to start and stop Java programs as a service. The YAJSW (http://yajsw.sourceforge.net/), an open source project under the LGPL license, which sets up services under Windows, many Unix systems and Mac OS X, provides a remedy. The very detailed documentation is up-to-date and leaves no questions unanswered.



your comment

How did you like the ? We always look forward to your friendly and critical feedback. >> To the feedback form