简体   繁体   English

如何在 Atom Editor 中运行程序?

[英]How to run a program in Atom Editor?

I found Atom editor as good free alternative to Sublime text editor.我发现Atom编辑器是 Sublime 文本编辑器的不错的免费替代品。 Not able to find a straightforward way to run a program in Atom editor.无法找到在 Atom 编辑器中运行程序的直接方法。 In my case, I am trying to run a java program.就我而言,我正在尝试运行一个 java 程序。 Please let me know if it's possible?请让我知道是否可能? If yes, please describe the steps to follow.如果是,请描述要遵循的步骤。

I find the Script package useful for this.我发现 Script 包对此很有用。 You can download it here .你可以在这里下载。

Once installed you can run scripts in many languages directly from Atom using cmd-i on Mac or shift-ctrl-b on Windows or Linux.安装后,您可以使用 Mac 上的cmd-i或 Windows 或 Linux 上的shift-ctrl-b直接从 Atom 运行多种语言的脚本。

  1. Click on Packages --> Commmand Palette --> Select Toggle .单击Packages --> Command Palette --> Select Toggle
  2. Type Install Packages and Themes .输入安装包和主题
  3. Search for Script and then install it.搜索脚本,然后安装它。
  4. Press Command + I to run the code (on Mac)Command + I运行代码(在 Mac 上)

For C / C++ programs there's very good package gpp-compiler .对于C / C++程序,有非常好的包gpp-compiler

Shortcuts:快捷方式:

  • To compile and run: F5编译运行: F5
  • To debug: F6调试: F6

You can go settings, select packages and type atom-runner there if your browser can't open this link.如果您的浏览器无法打开此链接,您可以进入设置,选择包并在那里输入atom-runner

To run your code do Alt + R if you're using Windows in Atom .如果您在Atom使用Windows ,请执行Alt + R运行您的代码。

If you know how to launch your program from the command line then you can run it from the platformio-ide-terminal package's terminal.如果您知道如何从命令行启动程序,那么您可以从platformio-ide-terminal包的终端运行它。 See platformio-ide-terminal provides an embedded terminal within the Atom text editor.参见platformio-ide-terminal在 Atom 文本编辑器中提供了一个嵌入式终端。 So you can issue commands, including commands to run your Java program, from within it.因此,您可以从其中发出命令,包括运行 Java 程序的命令。 To install this package you can use APM with the command:要安装此软件包,您可以通过以下命令使用 APM:

$ apm install platformio-ide-terminal --no-confirm

Alternatively, you can install it from the command palette with:或者,您可以从命令面板安装它:

  • Pressing Ctrl + Shift + P .Ctrl + Shift + P I am assuming this is the appropriate keyboard shortcut for your platform, as you have dealt ith questions about Ubuntu in the past.我假设这是适合您平台的键盘快捷键,因为您过去曾处理过有关 Ubuntu 的问题。
  • Type Install Packages and Themes .输入安装包和主题
  • Search for the platformio-ide-terminal .搜索platformio-ide-terminal
  • Install it.安装它。

This package in Atom can run scripts. Atom 中的这个包可以运行脚本。

Atom script package Atom 脚本包

press Alt+X for the running script.按 Alt+X 运行脚本。
For running javascript you need to install 'node js'要运行 javascript,您需要安装“node js”

Also pressing ctrl+shift+i in atom gives developer option like chrome同时在 atom 中按 ctrl+shift+i 会提供开发人员选项,例如 chrome

you can test javascript code side by side in atom editor.您可以在 atom 编辑器中并排测试 javascript 代码。

为了使其在 Windows 上正常工作,您需要在系统环境变量中手动设置JDK的路径( ...\\jdk1.x.x_xx\\bin )。

You can try to use the runner in atom Hit Ctrl+R (Alt+R on Win/Linux) to launch the runner for the active window.您可以尝试使用 atom 中的运行器 Hit Ctrl+R(在 Win/Linux 上为 Alt+R)来启动活动窗口的运行器。 Hit Ctrl+Shift+R (Alt+Shift+R on Win/Linux) to run the currently selected text in the active window.按 Ctrl+Shift+R(在 Win/Linux 上为 Alt+Shift+R)以在活动窗口中运行当前选定的文本。 Hit Ctrl+Shift+C to kill a currently running process.按 Ctrl+Shift+C 以终止当前正在运行的进程。 Hit Escape to close the runner window点击 Escape 关闭跑步者窗口

You can run specific lines of script by highlighting them and clicking shift + ctrl + b您可以通过突出显示并单击shift + ctrl + b来运行特定的脚本行

You can also use command line by going to the root folder and writing: $ node nameOfFile.js您也可以通过转到根文件夹并编写以下内容来使用命令行: $ node nameOfFile.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM