The following steps describe how you can extend the capabilities of Notepad++ to include compiling and executing Java programs from Notepad++ itself.
First, create a file called JavaCompileRun.bat. You can do this by right-clicking on your Windows' Desktop and then click New and Text Document. Then, key in "JavaCompileRun.bat" as the new file name. Right-click on this file and click Edit. Put in the following codes and save the file.
cd /d "%1" javac %2 if errorlevel 1 goto finish java %3 :finish pauseNext, copy the file JavaCompileRun.bat to your Notepad++ program folder, usually at C:\Program Files\Notepad++.
Open Notepad++. Select the Run menu and click on Run.... A dialog box will appears. Key in the following command.
$(NPP_DIRECTORY)\JavaCompileRun.bat "$(CURRENT_DIRECTORY)" "$(FILE_NAME)" "$(NAME_PART)"After keying in the above command, the dialog box should look something like this...
Click on the Save... button. In the Name: text box, key in "Java Compile and Save" as shown in the figure below.
Click OK and then click on the Run! button. Your Java program should compile and run if there is no error.
Now to compile the current Java program, make sure you have saved the file. Then, in the Run menu, click Java Compile and Run as shown.
A Command Prompt window will appear and the results of your Java program will be displayed.
There is however one serious limitation with this method. Only Java programs with default package will compile and run.
great guys ! But one little thing ,
ReplyDeleteStart your JavaCompileRun.bat with "@echo off"
Thank you !!