sublime 3 text 中运行Java
1、首先确保JDK安装和配置完成
2、在JDK的bin目录下添加runJava.bat文件
@echo off
cd %~dp1
echo Compiling %~nx1...
if exist %~n1.class (
del %~n1.class
)
javac -encoding UTF-8 %~nx1
if exist %~n1.class (
echo ------Output------
java %~n1
)
3、在sublime 3 text 的安装目录中找到Java.sublime-package,用压缩软件打开,找到JavaC.sublime-build,做以下的修改后保存更新
{
"shell_cmd": "runJava.bat \"$file\"",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"encoding": "UTF-8"
}
(注意是软件安装目录下的Packages文件夹,而不是通过菜单栏Preferences - Browse Packages 打开的Packages文件夹)
4、重启sublime 3 text,通过CTRL+B编译运行Java文件
5、字体
Preferences - Setting
{
"font_face": "YaHei Consolas Hybrid",
"font_options":
[
"no_bold",
"no_italic",
"no_antialias",
"gray_antialias"
],
"font_size": 14
}
6、快捷键“删除当前行”
Preferences -> Key Binding
[
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
7、Package Controll插件
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
8、编码插件
Preferences -> Package Controll >> Install Package
ConvertToUTF8
Preferences -> Package Setting -> ConvertToUTF8
"encoding_list" : [
["UTF-8", "UTF-8"],
["Chinese Simplified (GBK)", "GBK"],
["Chinese Simplified (GB2312)", "GB2312"],
["Chinese Simplified (GB18030)", "GB18030"],
["Chinese Traditional (BIG5)", "BIG5"],
["Korean (EUC-KR)", "EUC-KR"],
["Japanese (CP932)", "CP932"],
["Japanese (Shift_JIS)", "Shift_JIS"],
["Japanese (EUC-JP)", "EUC-JP"]
],