1.Tools -> Build System->New Build System
2.在新打开的页面输入以下代码
{
"cmd": ["javac", "-encoding", "UTF-8", "-d", ".", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"encoding": "UTF-8",
"variants": [{
"name": "Run",
"shell": true,
"cmd": ["start", "cmd", "/c", "java ${file_base_name} &echo. & pause"],
"working_dir": "${file_path}",
"encoding": "UTF-8"
}]
}
3.保存为Java.sublime-build文件
4.并在Build System中选中该文件名, 即 Java
5.按Ctrl+B或F7运行java文件即可。