ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-javac

by SublimeLinter ST3

SublimeLinter 3 plugin for Java, using javac -Xlint.

Details

Installs

  • Total 26K
  • Win 12K
  • OS X 8K
  • Linux 6K
Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7
Windows 10 3 7 7 6 10 12 8 7 15 7 5 7 7 11 13 13 7 6 10 13 14 9 16 13 5 12 16 14 7 15 13 3 11 12 10 11 5 8 3 8 12 9 11 5 3
OS X 3 0 6 5 6 2 3 4 3 9 2 2 4 3 4 11 4 2 3 9 6 2 7 5 1 7 2 6 3 2 8 6 4 6 6 6 5 1 4 4 4 3 2 3 2 1
Linux 4 7 5 3 2 5 5 3 3 3 6 4 5 0 5 5 4 4 6 1 5 3 5 3 2 3 4 4 4 4 2 7 5 3 3 4 7 1 1 3 4 4 2 2 3 0

Readme

Source
raw.​githubusercontent.​com

SublimeLinter-javac

Build Status

This linter plugin for SublimeLinter provides an interface to javac. It will be used with files that have the “Java” syntax.

IMPORTANT!

Please note that because javac requires a complete directory context in order to work, this linter plugin currently will only lint a file when it has been saved. As soon as you modify the file, all linter marks will be cleared.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before using this plugin, you must ensure that javac (JDK 1.7+) is installed on your system. javac is part of the java developer SDK, which can be downloaded here.

In order for javac to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover troubleshooting PATH configuration.

Settings

Additional SublimeLinter-javac settings:

Setting Description
lint A comma-delimited list of rules to apply.

Valid rule names are: all, cast, classfile, deprecation, dep-ann, divzero, empty, fallthrough, finally, options, overrides, path, processing, rawtypes, serial, static, try, unchecked, varargs, -cast, -classfile, -deprecation, -dep-ann, -divzero, -empty, -fallthrough, -finally, -options, -overrides, -path, -processing, -rawtypes, -serial, -static, -try, -unchecked, -varargs, none.

For example, to ignore deprecation warnings for all files in a project, you would add this to the linter settings:

"javac": {
    "lint": "all,-deprecation"
}

Passing options to javac

In order to configure javac options like the class path, source path, or file encoding, the args setting can be used.

Setting Description
args An array of strings, alternating between an option and the corresponding value.

A full list of available options is given here.

For example, the following configuration defines the source file encoding, includes the two libraries lib/some_lib.jar and lib/some_other_lib.jar in the classpath, and defines src/ as the project's source path:

"args": [
    "-encoding", "UTF8",
    "-cp", "${folder}/lib/some_lib.jar:${folder}/lib/some_other_lib.jar",
    "-sourcepath", "${folder}/src/"
]

Note that options and their values must be separate elements in the array (i.e. "args": ["-sourcepath", "/path/to/src"] does work, while "args": ["-sourcepath /path/to/src"] does not work).

Project-specific options

Settings like the class path often only apply to one specific project. The general SublimeLinter documentation also explains how to specify project-specific settings in the sublime-project file.

For the example above, such a project file could look like this: “ { "folders”: [ { “path”: “.” } ], “SublimeLinter”: { “linters”: { “javac”: { “lint”: “all”, “args”: [ “-encoding”, “UTF8”, “-cp”, “${folder}/lib/some_lib.jar:${folder}/lib/some_other_lib.jar”, “-sourcepath”, “${folder}/src/” ] } } } }