依次打开Sublime Text 3 > Tools > Build System > New Build System

因安装版本或者安装位置不同请自行修改目录

Python3环境

1
2
3
4
5
6
{
"cmd": ["/Library/Frameworks/Python.framework/Versions/3.6/bin/python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"env": {"PYTHONIOENCODING": "utf8"},
"selector": "source.python"
}
保存为 Python3.sublime-build

直接运行Java环境

1
2
3
4
5
6
7
8
{
"cmd": ["javac \"$file_name\" && java \"$file_base_name\""],
"working_dir": "${project_path:${folder}}",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"shell": true,
"encoding": "utf-8"
}
保存为 RunJava.sublime-build

在编译前选择Python3或者RunJava就好了