This plugin adds the following commands to sublime Command Palette:
JavaC: Compile Current File
JavaC: Compile & Run Current File
JavaC: Compile Current Project
JavaC: Compile & Run Current Project
JavaC: Generate Jar Package For Project
JavaC: Generate & Run Jar Package For Project
JavaC: Clear Project
Move to you "Sublime Text" packages folder and clone this repository to it:
git clone git@github.com:psychowico/SublimeJavaCompiler.git
When you trying compile simple java file, you should just use "JavaC: Compile Current File" or "JavaC: Compile & Run Current File" options. When you want compile full project, more complex, with namespaces, libraries etc. you need add to project configuration file. When you run "JavaC: Compile Current Project" command JavaC offer you to generate project configuration file. It will be settings.sublime-javac.
{
"project_name" : "HelloWorld",
"output_dir" : "output",
"sources_dir" : "src",
"encoding" : "utf-8",
"resources" : [],
"libs" : [],
"entry_file" : "Test/HelloWorld.java",
"entry_point" : "Test.HelloWorld"
}
Options meaning:
All pathes are relative to you project main directory (where settings.sublime-javac file is stored).
You can add keyboard shortcuts by clicking in you "Preferences/Key Bindings - User" and add additional lines:
{ "keys": ["f5"], "command": "javac_compile_and_run_project" },
{ "keys": ["f6"], "command": "javac_compile_project" },
{ "keys": ["shift+f5"], "command": "javac_compile_and_run_file" },
{ "keys": ["shift+f6"], "command": "javac_compile_file" },
{ "keys": ["ctrl+shift+f7"], "command": "javac_clear_project" }
You can change settings about Java path or hide output-window option.
Preferences -> Package Settings -> Sublime Java Compiler -> Settings - User
These are the basic settings you can change:
{
"java_path" : "java",
"javac_path": "javac",
"jar_path" : "jar",
"javac_autohide": true,
"hide_output_after_compilation": true
}