Setting up Netbeans

Revision as of 07:44, 22 September 2009 by jerome mouneyrac (talk | contribs) (CVS with NetBeans)

Jump to: navigation, search

NetBeans has got a good PHP support. You find a host of information on the website (tutorials, developer blog, screen casts, etc.).


  • CVS integration: see all changes, lines deletion, diff in real time, show annotations, diff history...
  • Ctrl+Click: Go to declaration
  • Export/Import Diff Patch
  • Easy navigation
  • List of functions
  • Code completion
  • Instant rename
  • HTML, CSS, JavaScript support
  • MySQL manager
  • Quick Search
  • Very few bugs


Set up for Moodle development

  • Checkout your Moodle project with a CVS client - see CVS for Administrators or CVS for Developers. I personally prefer to use an external client in order to realise the CVS Delete operation on my own.
  • Open File > New Project > PHP > PHP Application > Next
You're going to set the project now. Name, Location and Folder are used by NetBeans and are not related to the source code. So you can choose whatever you like, except your source folder. Sources has to be your checked out Moodle branch/head folder. The rest is clear enough. Don't forget to choose UTF-8 for Default Encoding.
Project Name:        Moodle 1.9 Stable
Project Location:    C:\Users\jerome\Documents\NetBeansProjects
Project Folder:      C:\Users\jerome\Documents\NetBeansProjects\Moodle 1.9 Stable
Project Sources:     C:\Users\jerome\Projects\branch19_STABLE\moodle
Project URL:         http://localhost/moodle19/
Index File:          index.php
Create:              unchecked
Default Encoding:    UTF-8
Set as Main Project: unchecked
  • Click on Finish.
  • Start coding!

CVS with NetBeans

NetBeans comes with integrated CVS support which might be the easiest way to check out Moodle.

  • In NetBeans, select Window->Versioning->CVS->Checkout
  • Select Team->CVS->Checkout
  • Enter into CVS Root:
(Non-US-residents might use one of the other Moodle CVS servers nearer to them.)
  • Click Next
  • Browse or enter into Module: moodle
  • Browse or enter into Branch: MOODLE_19_STABLE
  • Browse or enter into Local Folder: C:\xampp\htdocs
  • Click Finish (and wait a few minutes for Moodle to be checked out)
  • When you get the dialog box "Do you want to create an IDE project from the checked-out sources?", Click "Create Project..."
  • Select PHP Application with Existing Sources, and click Next
  • Browse or enter into Sources Folder C:\xampp\htdocs\moodle
  • Enter into Project Name: moodle
  • Keep the other defaults and click next
  • Run As: should have selected Local Web Site (running on local web server)
  • Enter into Project URL http://localhost/moodle/
  • Browse or enter into Index File: index.php
  • Click Finish

Netbeans can mess up easily CVS if you don't take care

  • If you want to delete a file from your computer but not from CVS, delete it from Windows Explorer/Nautilus/Finder. Otherwise your next commit could delete the file from CVS. If you've already deleted the file from Netbeans, just delete all the folder content of deleted file (including the CVS folder) and update the folder.
  • If you rename files and that other people are working on them, Netbeans could end up to mess up your CVS folder. Then Netbeans CVS will refuse to update your code displaying a no explicit error as Update Failed. In this case, delete the content of the damaged folder and update this folder.
  • If you create a patch or a new php file with Netbeans on Microsoft Windows, please check that it's a Unix format file. You may want to use another software to create Unix format patch/php file.


1. You may want to run Netbeans with the Sun JDK. Netbeans seems to work a bit better with the Sun JDK. Download it from [1]. You'll have to edit Netbeans config file. Open netbeans/etc/netbeans.conf. Then uncomment and edit:


2. To change the Netbeans look and feel run netbeans in the command line with this parameter:

"netbeans"  --laf javax.swing.plaf.metal.MetalLookAndFeel 

3. If Netbeans starts to slow down, give it more memory

"netbeans" -J-Xmx600m

Coding faster

You may want to have a look to the keyboard shortcut.
You can also follow the Netbeans PHP blog.

See also: