用Sublime Text搭建Java,C,C#的编译环境

编程语言的系统环境变量设置好了之后,在Sublime Text的“工具”里选择编译系统,选择新编译系统。输入以下代码,分别保存为后缀名为sublime-build的文件。

Java:
{
	"shell_cmd": "Java \"$file\"",
 	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
 	"selector": "source.java",
 	"encoding": "utf8"
}
C:
{
	"cmd": ["g++", "${file}", "-o","${file_path}/${file_base_name}"],
	"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
	"working_dir": "${file_path}",
	"encoding":"cp936",
	"selector": "source.c",
	"variants":[{"name": "Run","cmd": ["cmd","/C","start","cmd","/c", "${file_path}/${file_base_name}.exe &pause"]}]
}

C#:
{
	"cmd": ["csc", "$file"],
	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	"selector": "source.cs",
	"encoding": "cp936",
	"variants":[{"name": "Run","cmd": ["cmd","/C","start","cmd","/c", "${file_path}/${file_base_name}.exe &pause"]}]
}

保存好了之后,在“编译系统“里选择需要使用的编译系统,就可以使用编译或者运行了。

你可能感兴趣的:(其它操作)