Notepad ++ settings

Source: Internet
Author: User

1. notepad ++ how to set an open file encoding format for the UTF-8. The default value is ANSI.

Settings → preferences → new → Encoding

2. The function list plug-in is not included in the notepad ++ plug-in list, nor in the available list of the plugin manager.

Ii. Java Development Environment

3. Configure notepad ++

3.1 automatic word population full-featured Configuration

Notepad ++ provides a series of programming-related functions, such as automatic identification of source code types, automatic indentation, syntax coloring, and automatic completion of word/function names. By default, notepad ++ supports most of the code writing functions. The following describes how to enable notepad ++ to support the "Automatic completion of words" function.

Click "Settings" and select "Preferences". The "Preferences" dialog box is displayed. Select "backup and Automatic completion ", select the "enable auto-completion for all input" check box at the bottom of this tab, and select "auto-completion for words ".

3.2 The notepad ++ plug-in nppexec implements console dialog. This plug-in can complete basic functions of the Windows console, such as compiling and running Java programs in this window; notepad ++ can also run external programs, establish mappings with external programs through menu items, and support inputting parameters for external programs.


3.3 console dialog as a Java Development Environment

Show console dialog box

Click the ins main menu, select "nppexec" from the drop-down menu, and select "show console dialog" from the second menu ".

Console dialog is displayed at the bottom of the editor by default.


Edit Java source file

Create a new Java source file hellonpp. Java and enter the following content in the Editor:

Public class hellonpp {

Public static void main (string [] ARGs ){

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

}

}


3.4 compile a Java program

Switch to the console dialog window and compile hellonpp. Java

Java hellonpp. Java

In the console dialog, the compiler outputs 3 results. The black font in the figure indicates the user-input command, and the green font indicates the output information of the console dialog, which outputs more information than the Windows command line program, indicates the start and end of the program execution, and the final output indicates that the console dialog is waiting for a new command.


3.5 run Java program

Switch to the console dialog window and run:

Java hellonpp

Output results in the console dialog window.


4. Configure Java external tools

4.1 notepad ++ Environment Variables

Table 1 defines the environments for notepad ++ and can be passed as parameters to external tools.

Example of variable name meaning

Full_current_path file path name E: \ Java \ hellonpp. Java

Current_directory directory e: \ Java \

File_name file full name hellonpp. Java

Name_part file name hellonpp

Ext_part file extension Java


4.2 create an external tool

The two external tools are javac and Java, and the pause function is added. The output information can be displayed in the console window when Java programs are compiled or run.

4.2.1 javacnpp. BAT: Compile the current Java source file. A specified Java source file must be used as a parameter. After running, the screen is paused and the execution result of the compiled program is displayed. The javacnpp. Bat code is as follows:


@ Echo on

Javac % 1

Pause


4.2.2 javanpp. BAT: To run a Java class binary file, you must specify two parameters. The first parameter is the directory where the class file is located, and the second parameter is the Java program name. After running, the screen is paused and the execution result of the program is displayed. The javanpp. Bat code is as follows:


@ Echo on

Java-CP % 1% 2

Pause


4.3 create a javac menu

This menu is used to compile the Java source code and generate a class file. Select "run" from the main menu, select "Run..." from the drop-down menu, or press the shortcut key F5 to display the "run" dialog box. Enter the following program name:

"E: \ Program Files \ notepad ++ \ javacnpp. Bat" $ (full_current_path)


Javacnpp. bat is the external tool created above. $ (full_current_path) is the currently edited Java source code file.

Click "save" and enter the name of the tool, such as javac, In the name editing box. In the shortcut dialog box, select the shortcut key for executing the program, select (Control + Shift + J) as a shortcut for compiling Java source code.


4.4 create a Java menu

The Java menu is used to run the Java program. The creation method is the same as that of the javac menu, but different external tools are used respectively. In the "run" dialog box, enter the name of the running program:

"E: \ Program Files \ notepad ++ \ javanpp. Bat" $ (current_directory) $ (name_part)


Javanpp. bat is the external tool created above. $ (current_directory) is the directory where the Java class file is located, and $ (name_part) is the file name (excluding the extension ).

Click "save" and enter a name for the tool, such as Java, In the name editing box. In the shortcut dialog box, select the shortcut key for executing the program, select (Control + Shift + x) as the shortcut to run the Java program.


After the two external tools are created, two menu items are added to the "run" menu: javac and Java, which are used to compile the Java source code and run the Java program respectively. After writing in the code editing area, run the javac command (or press Ctrl + Shift + J) to compile the current Java source code file; after the compilation is passed, run Java (or press Ctrl + Shift + x) to run the compiled Java program.


5. Summary

This article describes how to use Notepad ++ to integrate with JDK as a simple Java IDE, suitable for beginners with Java. All Java source files are placed in the default package. The custom package is not used. If the import/package keyword is used, if you execute javac or Java according to the configuration described in this article, "Java. lang. noclassdeffounderror: "error. We recommend that you run it in console dialog.


Notepad ++ settings

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.