记事本软件n++
In this tutorial I will tell you about how to configure notepad++ to run C, C++, Java, Python, JavaScript, etc. programs.
在本教程中,我将向您介绍如何配置notepad ++以运行C,C ++,Java,Python,JavaScript等程序。
Notepad++ is a popular and free source code editor which is widely used by programmers. Even I use it very frequently. Today while editing a source code on notepad++ I thought that it will be great if there is any way to run the source code on it. Luckily I found a way that I am sharing below. I have mentioned steps only for C, C++ and Java. But the same method can be used to run programs of any other language.
Notepad ++是一种流行且免费的源代码编辑器,已被程序员广泛使用。 即使我经常使用它。 今天,当我在notepad ++上编辑源代码时,我认为如果有任何方法可以在其上运行源代码,那将是很棒的。 幸运的是,我在下面找到了一种分享的方式。 我只提到了C,C ++和Java的步骤。 但是,可以使用相同的方法来运行任何其他语言的程序。
Also Read: How to Run C and C++ Program in Sublime Text
另请参阅: 如何在Sublime Text中运行C和C ++程序
配置记事本++以运行C,C ++和Java程序 (Configure Notepad++ to Run C, C++ and Java Programs)
1. First of all download the notepad++ from below link.
1.首先从下面的链接下载notepad ++。
https://notepad-plus-plus.org/download/
https://notepad-plus-plus.org/download/
2. Now install and open notepad++.
2.现在安装并打开记事本++。
3. We require NppExec plugin that will help us to run programs. You can skip 3rd and 4th steps if the NppExec plugin is already present in notepad++. Go to Plugins > Plugin Manager > Show Plugin Manager.
3.我们需要NppExec插件,它将帮助我们运行程序。 如果NppExec插件已经存在于notepad ++中,则可以跳过第3步和第4步。 转到插件>插件管理器>显示插件管理器 。
4. Make sure you have internet connection because we are going to download plugin. In the new window you will get a list of all available plugins. Scroll down and select NppExec plugin from the list and install it.
4.确保您可以连接互联网,因为我们将下载插件。 在新窗口中,您将获得所有可用插件的列表。 向下滚动并从列表中选择NppExec插件并安装它。
5. Go to Plugins > NppExec > Execute. Now we have to create a script. In the new window enter following commands and then save it with any name.
5.转到插件> NppExec>执行 。 现在我们必须创建一个脚本。 在新窗口中输入以下命令,然后以任何名称保存。
For C and C++
对于C和C ++
npp_save cd $(CURRENT_DIRECTORY) C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe “$(FILE_NAME)” cmd /c “$(CURRENT_DIRECTORY)\a.exe”
npp_save cd $(CURRENT_DIRECTORY) C:\ Program Files(x86)\ Dev-Cpp \ MinGW64 \ bin \ g ++。exe“ $(FILE_NAME)” cmd / c“ $(CURRENT_DIRECTORY)\ a.exe”
For Java
对于Java
npp_save cd $(CURRENT_DIRECTORY) C:\Program Files\Java\jdk1.8.0_45\bin\javac “$(FILE_NAME)” C:\Program Files\Java\jdk1.8.0_45\bin\java “$(NAME_PART)”
npp_save cd $(CURRENT_DIRECTORY) C:\ Program Files \ Java \ jdk1.8.0_45 \ bin \ javac“ $(FILE_NAME)” C:\ Program Files \ Java \ jdk1.8.0_45 \ bin \ java“ $(NAME_PART)”
Replace “C:\Program Files (x86)\Dev-Cpp\MinGW64\bin” and “C:\Program Files\Java\jdk1.8.0_45\bin” with the path where compiler is installed in your computer.
将“ C:\ Program Files(x86)\ Dev-Cpp \ MinGW64 \ bin”和“ C:\ Program Files \ Java \ jdk1.8.0_45 \ bin”替换为在计算机中安装编译器的路径。
6. Then go to Plugins > NppExec > Advance Options. In the bottom left corner you will get a list of Associated script. Select the script that you have just created from the drop down list.
6.然后转到插件> NppExec>高级选项 。 在左下角,您将获得一个关联脚本列表。 从下拉列表中选择刚创建的脚本。
7. Click on Add/Modify button. Now you can see the script in the Menu items box at the top.
7.单击添加/修改按钮。 现在,您可以在顶部的菜单项框中看到脚本。
8. Click OK button, you have to restart the notepad++.
8.单击确定按钮,您必须重新启动记事本++。
9. After that go to Settings > Shortcut Mapper. Click on Plugin commands tab, there you will get the list of all the commands. Scroll down until you see the command with the name with which you have saved the script.
9.之后,转到设置>快捷方式映射器 。 单击“ 插件命令”选项卡,您将获得所有命令的列表。 向下滚动,直到看到带有保存脚本名称的命令。
10. Click on Modify button to choose a shortcut according to you. Make sure the shortcut is unique. Now close the window.
10.单击修改按钮,根据您的需要选择快捷方式。 确保快捷方式是唯一的。 现在关闭窗口。
11. Just write your program and run it using the shortcut key you created in previous step. You can see the output in the Console window as shown below.
11.只需编写您的程序并使用您在上一步中创建的快捷键运行它。 您可以在“控制台”窗口中看到输出,如下所示。
So this was the simple method to configure notepad++ to execute C, C++ and Java programs. If you are getting any problem then comment below, I will try to solve your problem.
因此,这是配置notepad ++以执行C,C ++和Java程序的简单方法。 如果您遇到任何问题,请在下面评论,我将尽力解决您的问题。
翻译自: https://www.thecrazyprogrammer.com/2015/08/configure-notepad-to-run-c-cpp-and-java-programs.html
记事本软件n++