1,首先要安装java环境
2,tools->build system->new build system...
{ "cmd": ["javac","-d",".","$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java", "encoding":"cp936", //执行完上面的命令就结束 // 下面的命令需要按Ctrl+Shift+b来运行 "variants": [ { "name": "Run", "shell": true, "cmd" : ["start","cmd","/c", "java ${file_base_name} &echo. & pause"], //c是执行完命令后关闭cmd窗口, // /k是执行完命令后不关闭cmd窗口。 // echo. 相当于输入一个回车 // pause命令使cmd窗口按任意键后才关闭 "working_dir": "${file_path}", "encoding":"cp936" } ] }
3,新建helloworld.java
public class helloworld { public static void main(String[] args){ System.out.println("welcome to java!"); } }
ctrl+shift+b 编译然后运行即可
原文地址:https://www.cnblogs.com/mangmangbiluo/p/10361183.html
时间: 2024-10-10 12:54:38