Netbeans plugin

Running JavaStyle in Netbeans.

Development versions may be obtained from After downloading JavaStyle appears as a directory which may be obtainedfrom the Tools menu.


Selecting the Options

Options Dialog

JavaStyle has many options for pretty printing and others for controlling the coding standards checking. These may be accessed either from the menu Tools->JavaStyle->Options.. This allows the options for particular projects to be set seperately (not yet implemented) at present you just get the default options).

The option system is quite complex, it will allow almost any style of pretty printing you could desire, don't be afraid to experiment, copy a complex Java source file to a temporary location and see the results on that. You will almost certainly need to change the Author in the JavaDoc Tags tab (its currently set to me!).

If you need to look at the pretty.settings options file look in <user.home>/.netbeans/javastyle/.JRefactory for the default settings, settings for the projects are contained in subdirectories from here.

Perhaps the two most important options are on the General tab Reformat when buffer is saved when ticked causes JavaStyle to reformat the buffer whenever it is saved (i.e just before it is saved) and this could change how your code looks considerably (sorting the methods for example). The other Perform coding standards check when buffer is saved is very useful on fast machines as it notifies you of problems immediately, it is however quite slow and so most appropriate for fast machines (2GHz Pentium 4 equivalent or faster)

Each Project may have its own values of any of the options, they are stored as changes to the default options. Tick the left hand box on a project option pane and then select the desired state of the option forthat project.

Note: the current version of JavaStyle is not very efficient at creating the Options dialog box. It may take several seconds to load if there are lots of  projects.

Building the JavaStyle plugin yourself

There are three ways of building JavaStyle for jEdit.

Its Easiest, to download the and unzip directly into a clean directory. You should have a directory structure something like this:

Editorial: provide instructions

Alternatively download the whole distribution, unzip it into a clean directory.

Editorial: provide instructions

Alternatively use anonymous CVS to download the current version of JReafactory and build it. It is found on sourceforge.

About Netbeans

provide description

The tools

Pretty Printer/Beautifier is a tool that allows you to clean up the indenting and formatting of your java source code.

This tool has a powerful feature of being able to insert the appropriate javadoc comments so that the javadoc program does not generate error messages for missing fields. To simplify writing javadoc comments, some methods have javadoc comments automatically generated based on the name of the method.

JRefactory is a tool that allows you to perform the following refactorings:

It updates the java source files as appropriate.

This tool comes as a command line option with GUI or without, and as a plugin for the JEdit (still under development), JBuilder, NetBeans, Elixir, and JBuilder IDEs.

For JBuilder and Elixir you can switch from the UML diagram to the source code.

Printing provides the ability to print UML diagrams.

BugFinding uses the findbugs tool to find many common sources of bugs in code.

UML Diagrams come as part of the Refactoring support, they can be resized are useful for navigating round lots of code.

Cut & Paste detection looks for similar sections of source code throughout a set of files.

AST Viewer shows the result of the Java parser as an Abstract Syntax Tree. XPath queries may be performed on the tree.

Metrics gathers metrics about your java source code.

Stub Generator creates a file that allows the refactory tool to display Java JDK library classes (or other applications where you have access to the source code, but you don't intend to change the source code). This facility is used for the refactoring tool to show classes from 3rd party vendors in the refactoring GUI. (This has been tested on JDK 1.4.2_01, but should work with other Java 2 JDKs)

Last Modified: 28 April 2004