notepad++ Configuring the Java compilation Runtime environment

Source: Internet
Author: User

notepad++ plug-in nppexec implements the console Dialog, which can complete the basic functions of the Windows console, such as the ability to compile, run in this window Java program;notepad++ is also able to run external programs, establish mappings between menu items and external programs, and support input parameters for external programs.

1. Using the Console Dialog as the Java development environment

ShowConsole Dialogdialog Box
Click"Plugins"The main menu, in its drop-down menu, select"Nppexec", in the Level two menu, select"Show Console Dialog". Default appears at the bottom of the editorConsole Dialog.

2.1 Compiling and running Java programs

Editing Java source files

Create a new Java source file Hellonpp.java, and enter the following in the editor:

public class hellonpp{

public static void Main (string[] args) {

System.out.println ("Hello notepad++!");

}

}

Environment variables for 2.2 notepad++

Notepad has two running code functions, one is run (F5), the other is plugins-nppexec (F6), the former is difficult to achieve, so choose the latter, his command line simulation is very useful.

First press F6, the dialog box that executes the command pops up, and the following four lines are entered in command (s):

npp_save//Saving files

CD "$ (current_directory)"

D:\jdk1.7.0_10\bin\Javac.exe "$ (file_name)"//Note: Java path is already set and can be used directly: Javac.exe "$ (file_name)"

D:\jdk1.7.0_10\bin\java.exe "$ (name_part)"//java.exe "$ (name_part)"

This explains the notepad++ environment variable, current_directory represents the current path, which is the path of the currently edited file. Then save as Buildandrun script, which means compile and run. Later F6, you can select the script directly without having to enter the command.

Take document E:\java\HelloNpp.java as an example to illustrate

1. Full_current_path: Indicates the full path of the current file is: E:\java\HelloNpp.java

2. Current_directory: Indicates the directory where the current file is located, excluding the name of the file at this time: E:\java\

3. file_name: Represents the full file name of the current file, excluding the directory: Hellonpp.java

4. Name_part: Indicates the file name of the current file, not including the suffix or extension name: HELLONPP

5. Ext_part: Indicates the suffix or extension of the current file: Java

3. Add a subkey to a menu macro

After completing the above settings, each compile and run will press F6 to bring up the script list and select, in fact, you can add a specific subkey in the menu bar's Macro menu. Here's how:

3.1. Click the plugin->nppexec->advanced options pop-up menu below

3.2. Under menu item, give the name of the macro subkey menu that is about to be added, such as "compile ADN run Java", and select the associated script name in the associated script, and select the script that we saved in section 2.4.

3.3. Click on the add/modify, this appears in the Macro menu has just established subkey: Compile ADN Run Java, the next direct click on the Macro menu compile and run Java command is equivalent to execute the script just in 2.4.

4. Configure shortcut keys

In the Menu macro select Manage shortcut key in the Plugin commands panel to find the script name you just saved compile and run Java, double-click to fill in the shortcut key. We fill out the compile and run Java as alt+z, and then go to our program and press Alt+z to compile and run the Java file.



notepad++ Configuring the Java compilation Runtime environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.