Home > Development Tools > sublime > body text

Run Java programs using sublime text3

藏色散人
Release: 2021-04-19 19:45:29
forward
3847 people have browsed it

The tutorial column of sublime below will introduce to you how to use sublime text3 to run Java programs. I hope it will be helpful to friends in need!

Run Java programs using sublime text3

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. .

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"
}
]
}
Copy after login

(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 Run Java programs using sublime text3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template