如何在 Eclipse 中运行系统 shell/终端?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44220993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:41:59  来源:igfitidea点击:

How to run system shell/terminal inside Eclipse?

eclipseshellterminal

提问by psuzzi

I am using Eclipse Neon, and I would like to execute system commands on a shell/terminal, inside Eclipse.

我正在使用 Eclipse Neon,我想在 Eclipse 内的 shell/终端上执行系统命令。

In particular, I will need to open the system shell using the path of the current project folder on which I'm working in Eclipse.

特别是,我需要使用我在 Eclipse 中工作的当前项目文件夹的路径打开系统 shell。

回答by psuzzi

In some Eclipse packages, like STS or Eclipse for JEE Developers, the Terminal is already installed in your IDE. If not, you can install the TM Terminalfrom the Eclipse */release update site, as you can see in the image below.

在某些 Eclipse 包中,如 STS 或 JEE 开发人员的 Eclipse,终端已安装在您的 IDE 中。如果没有,您可以从 Eclipse */release 更新站点安装TM Terminal,如下图所示。

enter image description here

在此处输入图片说明

To open the command prompt (shell or terminal) using the path of a project directory inside Eclipse, you just need to select the folder, and press Ctrl+Alt+T, or right-click and select Show In Local Terminal > Terminal.

要使用 Eclipse 中的项目目录路径打开命令提示符(shell 或终端),您只需选择文件夹,然后按 Ctrl+Alt+T,或右键单击并选择Show In Local Terminal > Terminal

Then, the terminal will open in a new view inside Eclipse.

然后,终端将在 Eclipse 内的新视图中打开。

enter image description here

在此处输入图片说明

回答by Rajesh Kumar Sahoo

The Eclipse IDE which I am working there is no Terminal is there. So I needed to add the plug in like this and it works fine when you try clicking Alt+Ctrl+T

我在那里工作的 Eclipse IDE 没有终端。所以我需要像这样添加插件,当你尝试点击Alt+ Ctrl+时它工作正常T

Click on Help in Eclipse-->Eclipse Marketplace--> in Find box (Search terminal and Enter)--> You will see TM Terminal 4.0 Version and just install it.

在Eclipse中点击Help-->Eclipse Marketplace-->在Find框中(搜索终端并回车)-->您将看到TM Terminal 4.0 Version并安装它。

You may need to restart afterwards

之后您可能需要重新启动

And finally you will be able to get the Terminal when you will type

最后,当您输入时,您将能够获得终端

Alt+Ctrl+Ton Console.

Alt+ Ctrl+T的控制台。

回答by dan1st

If you don't have the TM Terminalplugin installed, you could use external run configurations.

如果您没有TM Terminal安装插件,您可以使用外部运行配置。

Click on the arrow near run button with the toolbox and add a new external run configuration. external run configurations

单击带有工具箱的运行按钮附近的箭头并添加新的外部运行配置。 外部运行配置

Here, you can enter the path of your program(if you want to run commands, it will be C:\Windows\System32\cmd.exe(or the path to PowerShell on windows and /bin/bash(or similar if you use another shell) on linux. select cmd

在这里,您可以输入程序的路径(如果您想运行命令,它将是C:\Windows\System32\cmd.exe(或 Windows 上的 PowerShell 路径和/bin/bash(或类似,如果您使用另一个 shell)在 linux 上)。 选择命令

In this dialog, you can also specify running directory of the application(the current project in your case)

在此对话框中,您还可以指定应用程序的运行目录(在您的情况下为当前项目)

After that, you can save this configuration and start it using the external run configuration menu(run button with toolbox)

之后,您可以保存此配置并使用外部运行配置菜单(带有工具箱的运行按钮)启动它