Plugin for Sublime Text 2 and 3 that allows you to format Java files with the Eclipse formatter.
Failed to load latest commit information.
.gitignore add newlines to ends of files. add *.cache to gitignore May 30, 2012 change from application command to window command Nov 20, 2013
EclipseJavaFormatter.sublime-commands add newlines to ends of files. add *.cache to gitignore May 30, 2012
EclipseJavaFormatter.sublime-settings sort_imports false by default Jul 10, 2012

Basic Config

At a minimum, include the following configuration block in either your user or project settings:

  // you may not even need this one if eclipse is on your path
  "eclipse_command": "/path/to/eclipse/install/eclipse",

  "config_file": "/path/to/org.eclipse.jdt.core.prefs"

For information on how to find and/or generate your config_file, look here: Formatting your code using the Eclipse formatter

Import Sorting

If you want, EclipseJavaFormatter can automatically sort imports after formatting. This feature is not an external call to Eclipse, and it does not attempt to do any sort of autoimporting.

"sort_imports": true

It will, however, honor any overrides that you wish to include, much like the actual eclipse import sorter.

"sort_imports_order": ["java", "javax", "org", "com"]

Note: Right now, sort_imports will blow away any comments between the first and last import statements.

Line Endings

If you need to preserve your line endings, add the following:

"restore_line_endings": true


If you use gradle and SublimeJava for your java development, you may be interested in my gradle plugin.