[英]How to make Sublime Text 3 compile and run java through terminal on Ubuntu
I am trying to create a Sublime Text 3 build system to compile and run my java code through the terminal on Ubuntu, not the built in window in the bottom of the Sublime window which i circled in red. I am trying to create a Sublime Text 3 build system to compile and run my java code through the terminal on Ubuntu, not the built in window in the bottom of the Sublime window which i circled in red.
The current build system I'm using is this:
我正在使用的当前构建系统是这样的:
{
"shell_cmd": "javac \"$file\" && java \"$file_base_name\"",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
}
Which works, just it doesn't open it in the terminal like i want it to.哪个有效,只是它没有像我想要的那样在终端中打开它。 On my windows machine I use this:
在我的 windows 机器上,我使用这个:
{
"cmd": ["javac", "$file_name","&&","start","cmd","/k","java", "$file_base_name"],
"path":"C:\\Program Files\\Java\\jdk-11.0.3\\bin",
"shell": true
}
Which does run it in cmd, just obviously on windows not linux哪个在 cmd 中运行它,显然是在 windows 上而不是 linux
This question is very similar to the following: How to set up Sublime text 3 to run and compile java on linux?这个问题与下面的问题非常相似: How to setup sublime text 3 to run and compile java on linux? which is where i got the current build system, just they wanted it to run in sublime not terminal
这是我获得当前构建系统的地方,只是他们希望它在崇高而不是终端中运行
Here is my code for sublime in ubuntu which will popup gnome-terminal and then will execute the code there.这是我在 ubuntu 中的 sublime 代码,它将弹出 gnome-terminal 然后将在那里执行代码。
{
"cmd": ["javac", "$file"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.java",
"variants":
[
{
"name": "Run",
"shell": true,
"cmd": ["gnome-terminal -e 'bash -c \"java ${file_base_name};tput dim;tput setaf 6; echo; echo -------------------------------------------------------------------------------- ;tput sgr0;tput setaf 6;echo;echo Done Shivam now Press ENTER to continue; read line;exit; exec bash;\"'"]
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.