1. Installing the JDK
Download JDK 6 download
Http://developers.sun.com.cn/download/java_se.html
Run Setup, follow the onscreen prompts to complete the installation of JDK 6, following the installation path:
E:\Program files\java\jdk1.6.0_02
Run the Command control program and execute the following command:
Javac
The system prompts the following error:
' Javac ' is not an internal or external command, nor is it a program or batch file that can be run.
To make it easy to use the tools in the JDK in the console window, you need to append the path to the JDK binary (bin) file in the Windows System environment variable path and update the PATH environment variable by executing the following command in the console window.
Set path=.; %path% E:\Program Files\java\jdk1.6.0_02\bin
2. Installing notepad++
notepad++ is a code editor software running under the Windows operating system, capable of syntax coloring for most programming languages, for free software, following the GPL. For:
Http://notepad-plus.sourceforge.net/uk/site.htm
Follow the onscreen prompts to complete the installation.
3. Configure notepad++
3.1 Word Auto-complete function configuration
notepad++ provides a range of programming-related features such as automatic recognition of source code types, support for automatic indentation, syntax coloring, support for Word/Function name auto-completion, and more. notepad++ default settings support most of the code authoring functionality, and the following will enable notepad++ to support the word auto-complete feature.
Click on the "Settings" menu, select "Preferences" menu item, pop Up "Preferences dialog", select "Backup and AutoComplete", at the bottom of this tab, select "Enable AutoComplete for all inputs" check box, and choose "Word AutoComplete".
3.2 notepad++ Plug-in NPPEXEC implementation console Dialog, this plug-in can complete the basic functions of Windows console, such as can be compiled in this window, run Java program, notepad++ can also run external programs, Through the menu items and external programs to establish a mapping relationship, support for external programs input parameters and so on.
3.3 Console Dialog As a Java development environment
Show Console Dialog dialog box
Click on the "plugin" main menu, select "Nppexec" in its drop-down menu and select "Show Console Dialog" in the level two menu.
Console Dialog appears by default at the bottom of the editor.
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++!");
}
}
3.4 Compiling Java programs
Switch to the Console dialog window and compile the Hellonpp.java
Java Hellonpp.java
In the console dialog compiler output such as 3, the figure of the black font represents the user Input command, the green font for the console dialog output information, compared with the Windows command-line program output some information, indicating the start and end of the program execution, The last output information indicates that the console dialog is waiting for a new command state.
3.5 Running Java programs
To switch to the Console dialog window, do the following:
Java HELLONPP
Outputs the results in the Console dialog window.
4. Configure Java External Tools
4.1 notepad++ Environment variables
Table 1 These environments defined for notepad++, which 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 file directory E:\java\
file_name file Full name Hellonpp.java
Name_part file name hellonpp
Ext_part file extension Java
4.2 Creating an external tool
These two external tools are Javac and Java, with the addition of a pause feature that allows you to display output information through a console window as you compile or run a Java program.
4.2.1 Javacnpp.bat: Compiles the current Java source file, requires a specified Java source file as a parameter, the screen is paused after the run, and displays the execution result of the compiler. The following is the Javacnpp.bat code:
@echo on
Javac%1
Pause
4.2.2 Javanpp.bat: Run Java's class binary, you need to specify two parameters, the first parameter is the directory where the class file, the second parameter is the Java program name. The post-run screen is paused, showing the results of the program execution. The following is the Javanpp.bat code:
@echo on
JAVA-CP%1%2
Pause
4.3 Creating the Javac Menu
This menu item is used to compile the Java source code and generate the class file. Select the main Menu "Run", select "Run ..." in the drop-down menu, or use the shortcut key F5, display the "Run" dialog box, enter the following to run the program name
"E:\Program Files\notepad++\javacnpp.bat" $ (Full_current_path)
Javacnpp.bat for the above created external tool, $ (full_current_path) for the currently edited Java source code file.
Click the "Save" button, enter the name of this external tool in the name edit box, such as Javac; in the shortcut dialog box, select the shortcut key to execute this external program, check (CONTROL+SHIFT+J) as a shortcut to compile the Java source code.
4.4 Creating a Java Menu
Java menus are used to run Java programs in the same way as the Javac menu, but each using a different external tool, enter the name of the running program in the Run dialog box:
"E:\Program Files\notepad++\javanpp.bat" $ (current_directory) $ (Name_part)
Javanpp.bat for the external tool created above, $ (current_directory) is the directory where the Java class file resides, and $ (name_part) is the file name (with no extension).
Click the "Save" button, enter the name of this external tool in the name edit box, such as Java; In the shortcut dialog box, select the shortcut key to execute this external program, and check (Control+shift+x) as a shortcut to run the Java program.
With these two external tools, two menu items are added to the Run menu: Javac and Java, respectively, to compile Java source code and run Java programs. After the code editing area has finished writing, execute the javac command (or use the shortcut key Ctrl+shift+j) to compile the current Java source code file, and then execute Java (or use the shortcut key Ctrl+shift+x) to run the compiled Java program after compiling.
5. Summary
This article describes how to use notepad++ with JDK integration as a simple Java IDE, suitable for beginners with Java. All Java source files are placed in the default package (the package), and if you use the Import/package keyword and follow the configuration described in this article to execute Javac or Java, you will see " Java.lang.NoClassDefFoundError: "Error, recommended for use in console dialog.
notepad++ Java Development Environment configuration