Friday, March 25, 2011

Compiling and Running Java program from Notepad ++

 

I am great fan of Edit+ for compiling and running java programs. But now days Edit+ is no more available for free Sad smile. So I have shifted to Notepad ++ , it is powerful and easy to use editor. One of the major features of Edit+ is ease of configuring java environment to compile/run Java program, that’s missing in Notepad++.

Recently I have found out configuring Notepad Plus Plus so that one can compile and run run java program right from it. Just follow below few steps

  • Locate Run option on Notepad ++ on main menu bar.

2011-03-25_2147

2011-03-25_2154

  • Here we are going to use Notepad++’s environment variables . Copy following text in run dialog box

javac -classpath $(CURRENT_DIRECTORY) $(FULL_CURRENT_PATH)

  • Select Save as option and then provide title “javac” and shortcut information.

2011-03-25_2232

After these steps , you will notice new option “javac” under “Run” menu.

2011-03-25_2231

This will compile current opened java class and creates .class file under same directory. Same above steps need to followed to create “java” run option  to run compiled java class. Use following command string in run dialog box.

java -classpath $(CURRENT_DIRECTORY) $(NAME_PART)

 2011-03-25_2233

 

References: http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Defining_User_Commands

1 comment: