Home >Development Tools >sublime >Will you use sublime text3 to run Java programs?

Will you use sublime text3 to run Java programs?

藏色散人
藏色散人forward
2020-07-27 13:16:383408browse

The following tutorial column will introduce you to the method of running Java programs with sublime text3. I hope it will be helpful to friends in need!

Since I don’t want to learn Java in the IDE, I want to use sublime for Java development, so there is the question of how to compile and run Java in sublime. .

Will you use sublime text3 to run Java programs? I found many tutorials on the Internet, but I still couldn't output the results. Later I found out that it was due to a deviation in my understanding. (Write it down. When you read the article in the future, you must fully understand its content and meaning before you can act).

(1) First, find the sublime package folder and find the java.sublime-pakage compressed package in it:

(2) Use Open it with decompression software (emphasis on: not decompressing it directly) (I use 360 ​​decompression):

(3) Write a JavaC.sublime-build file ( The suffix is ​​sublime-build, the content is as follows):

{
"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"
}
]
}
(4) Add the written file to the java.sublime-pakage compressed package (just copy and paste it directly)

(5 ) Then reopen sublime, write the Java source file, and then press ctrl shift b. You can choose to compile or run. The results are as follows:

# #(6)Satisfactory ending, happy! ! !

The above is the detailed content of Will you use sublime text3 to run Java programs?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete