Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Java: javac

LCD 47 edited this page Jun 12, 2016 · 27 revisions

This file is no longer maintained

This file exists only as a historic reference. Documentation for syntastic checkers is now included in the manual, please see :help syntastic-checkers in Vim.


Maintainers:

Commands

The following commands are available:

:SyntasticJavacEditClasspath
This opens a new window where you can specify a classpath. Individual paths may be specified one per line, or separated by colons : on UNIX, or by semicolons ; on Windows.
:SyntasticJavacEditConfig
This command is relevant only if g:syntastic_java_javac_config_file_enabled is set. It opens a buffer where you can specify project-specific options from the list below. These options will be saved in a file pointed to by g:syntastic_java_javac_config_file (.syntastic_javac_config by default). Set g:syntastic_java_javac_config_file to a full path to use a project-wide configuration file, rather than a file in the current directory. The settings have to be specified as Vim commands.

Checker options

g:syntastic_java_javac_executable (string; default: 'javac')
Java compiler executable used for checking files.
g:syntastic_java_maven_executable (string; default: 'mvn')
Maven executable used for loading maven project classpath.
g:syntastic_java_javac_options (string; default: '-Xlint')
Options for javac.
g:syntastic_java_javac_classpath (string; default: '')
Classpath. It can be changed by running the SyntasticJavacEditClasspath command.
g:syntastic_java_javac_delete_output (boolean; default: 1)
When set the checker will delete the .class files created by javac.
g:syntastic_java_javac_autoload_maven_classpath (boolean; default: 1)
If enabled and a file pom.xml is found in the current working directory, maven is used to load classpath.
g:syntastic_java_javac_config_file (string; default: '.syntastic_javac_config')
Path to the configuration file used by javac. As usual, if a filename is specified rather than a full path, the file is created and looked for in the current directory.
g:syntastic_java_javac_config_file_enabled (boolean; default: 0)
When enabled, the classpath is written to the file pointed to by g:syntastic_java_javac_config_file. The file is created as needed. You can edit this file with the :SyntasticJavacEditClasspath command. The change will take effect next time you run the checker.
g:syntastic_java_javac_custom_classpath_command (string; default: '')
When specified will execute a custom command to get a classpath. The command classpath output can be in traditional Java form, or specified on separate lines. %FILE_PATH%, %FILE_NAME%, and %FILE_DIR% are expanded to the current file's full path, filename, and base directory respectively, all of them escaped for use in a shell command.

Using Ant

When using ant you can have a custom build target (named for example 'path') that will output your project's classpath. You can then use :SyntasticJavacEditConfig and add the following line to use it with javac checker:

let g:syntastic_java_javac_custom_classpath_command =
    \ "ant -q path | grep echo | cut -f2- -d] | tr -d ' ' | tr ':' '\n'"

Using Gradle

For Gradle projects you might consider using gradle-syntastic-plugin. This will write the relevant classpath to a .syntastic_javac_config file.

Clone this wiki locally