I am trying to compile and run Java code in Sublime Text 2. Don\'t just tell me to do it manually in the Command Prompt. Can anyone tell me how?
Btw, I am on Windows
This version of JavaC.sublime-build which is edited from vijay's answer works for me on both Windows 7 and Mac for Sublime Text 3.
I edited it so Ctrl+b or command+b is sufficient for both build + run.
{
"shell_cmd": "javac -Xlint $file && java $file_base_name",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"shell": true
}
'&&' ensures that the second part runs only when first part succeeds ie only when the class file is generated. You can find more related info here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true