Wednesday, February 15, 2012

Setting up Notepad ++ for Java development

There are many editors out there that can be used for writing Java programs. Notepad ++ is a free and simple Notepad like application that also supports programming languages like C++, HTML, Java and others. Unlike Textpad or JCreator it does take some setting up before its ready for use.

  1. Grab Notepad ++ (download.com link)
  2. Install the program
  3. Once its all set up you will need to download a special plugin called NppExec for it that will allow it to compile and run code. It might be also worthwhile to have a look at the rest of the plugins and see if anything catches your interest ( http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central)
  4. Now the easy way to get NppExec is through Notepad++'s plugin manager, it will download and install it for you automatically. Installing it yourself can get a bit tricky. Open Notepad++ and go to Plugins -> Plugin Manager -> Show Plugin Manager
  5. Once open, scroll down and find NppExec and check the box next to it and click 'Install'
  6. Now you have the ability to execute Java programs! But we're still not done yet, we want the program to be able to run the currently active code that we are writing. Press F6 on your keyboard, that will open a command window. Type in:
    cd $(CURRENT_DIRECTORY)
    javac $(FILE_NAME)
    Save that command as Compile so you don't have to write it in every time. This will allow you to compile your code.
  7. Now click on the drop down menu and select to get a new blank box and type in:
    cd $(CURRENT_DIRECTORY)
    java $(NAME_PART)
    Save that as Run and this will be the command that will allow you to run your code.
  8. Now all you need to do it type in your code, press F6 and choose either Compile or Run. Your console will appear at the bottom.
     
That's all. Please comment bellow if you need any more help.
Thanks to these guys here for the Run and Compile commands.

No comments:

Post a Comment