Jindent - Java Source Code Formatter http://www.jindent.com
 



title

2 Jindent


The Jindent application is a command line wrapper for the Jindent formatting engine.
Since this tool does not contain any graphical user interface it can be used for console invocation, in scripts and in batch processes.


title

2.1 Invocation



Depending on the used installation package Jindent can be invoked in several ways:



Options


Options are defined as follows:

-x, -execute xjp-file Formats a Jindent project defined by the xjp-file
To create or edit Jindent project files (xjp-files)
use the Jindent Commander application.
-fl listfile Formats the files specified in a list file.
To create or edit list files use your favourite
text editor.
-d, -dest path Set destination directory for output files.
-m, -mute Mute mode - Supress all messages.
-r, -recursive Format all files in subdirectories recursively too.
-c, -copy Copy resource (non-source code files) to destination directory.
-p, -s, -set xjs-file Set Jindent settings file (xjs-file)
If no explicit path is given then Jindent will use
its internal settings file by default
To create or edit Jindent settings files (xjs-files)
use the Jindent Customizer application.
-h, -help, -? Help for parameter usage.



Files


The file types are defined as follows:


xjp-file
Jindent project file - Stores a Jindent formatting task. Jindent project files can be created and modified using the Jindent Commander application.

xjs-file
Jindent settings file - Contains Jindent settings. Jindent settings files can be created and modified using the Jindent Customizer application.
listfile List file - Contains a list of input files. List files be created and modified using any ordinary text editor. The icon depends on the extension and the desktop integration of that extension.



Wildcards


The Jindent command line interface support the wildcard characters '*' and '?'. You can use wildcard characters to filter your files by specifying your input files by a wildcard expression. The character '*' substitutes any sequence of characters and the character '?' substitues one single character. Wildcard characters are supported in the last path element of a file path only. You must not use wildcard character in any leading path element of your input file argument.

Example:

Allowed wildcard expression:

Jindent "C:/Projects/*.java"

Not supported wildcard expression:

Jindent "C:/Projects/*/File.java

In combination with the rescursive mode ('-r','--recursive') all wildcard expressions are applied to any subdirectory of the input file argument as well.

Example:

Recursive wildcard expression:

Jindent -r "C:/Projects/*.java"

This will format all files in any subdirectory of 'C:/Projects' that match the wildcard expression '*.java'



Please note: To avoid that your command shell expands any wildcard expressions before they are passed to Jindent please enclose all arguments that contain wildcard expression in quotes !


Invocation Examples


Examples to run Jindent as a command line tool:

Print Jindent's help:

Jindent -h



Run Jindent with a specific settings file and format input file:

Jindent -p MyStyle.xjs inputFile



Run Jindent with a specific settings file and format complete directory and subdirectory structure:

Jindent -r -p MyStyle.xjs inputDir



Run Jindent with a specific settings file and format complete directory and subdirectory structure. Additionally write output to a new directory:

Jindent -r -p MyStyle.xjs -d newOutputDir inputDir



Run Jindent with a specific project file, execute the project and suppress all output messages:

Jindent -m -execute MyProject.xjp



Please note: Formatting with STDIO is not supported yet!



Exit Codes


Jindent's console application creates exit codes after terminating.
These exit codes can be used inside scripts and batch files to control further processing.

List of exit codes:

0 No error and warning occured while formatting
1 At least one error occured while formatting
2 No error but at least one warning occured while formatting