Installing and configuring NetBeans
NetBeans is a powerful Integrated Development Enivronment (IDE) for Java (and also PHP, C/C++ and Ruby).
These notes apply to version 6.5 and later and are intended to create a common minimum configuration for NetBeans that facilitates the sharing of teaching material and development resources.
- Download the "all" bundle. The Java bundle is acceptable if you do not wish to use any of the other languages, but the others form a relatively small part of the download so you might as well install all of them.
- If you have previously installed NetBeans, you may already have an earlier version of Glassfish installed. You may wish to uninstall this before proceeding.
- Install NetBeans. During installation:
- Ensure that on the list of packs and runtimes to install includes at least:
- Java SE
- Common Web Components
- Java Web and EE
|Installation folder for
||Abbreviation used in notes below
||Typical location (on my system at least!)
||C:\Program Files\NetBeans 8.0.1
Importing settings from a previous version
- When a new version of NetBeans is run for the first time, it asks if you want to import settings created by a previous version (e.g. 7.1) if you have them. You probably want to say yes unless you want to disregard those.
- Note that it will NOT offer to import settings from a beta or release candidate version. Copying the entire config folder (e.g. C:\Documents and Settings\briggsj\.netbeans\6.5rc1\config) to the corresponding location in your newly installed configuration may have the desired effect, but I can't guarantee it!
User interface preferences
I recommend the following settings
- If not already enabled,
- View | Show line numbers
- View | Toolbars | Debug
Some plug-ins that are installed by default are superfluous and can be removed:
Usually, the NetBeans installation includes all the libraries you will need to run my (and your) web applications, but occasionally you may need additional libraries. The ones I use I curate as follows:
- Tools | Plugins | Installed
- Click on the following to mark them for uninstallation (unless you actually use these systems for version control):
- Tools | Plugins | Available
- Install the following (if they are not already installed):
- Subversion (essential for the course)
- JIRA (useful)
- Team Server (useful)
- If you are running NetBeans on a University PC or connected to the University network (e.g. using WebDrive):
- the necessary library files can be found at K:\Student\Technology\Computing\BriggsJ\jars\Nblib
- libraries will be updated periodically and updates will be included in your project(s) automatically the next time you use NetBeans
- If you are running NetBeans elsewhere, or on a University PC that does not provide access to the K: drive:
- create a folder <nblib> (e.g. My Documents\nblib or N:\nblib) to act as a central repository for your library files
- the necessary library files can either be:
- [preferred way] downloaded from my Kenai SVN repository: URI https://svn.kenai.com/svn/sums~JimWEBPResources using a tool such as TortoiseSVN, SlikSVN or SmartSVN.
- copied from K:\Student\Technology\Computing\BriggsJ\jars\Nblib to <nblib>
- ensure that your copy includes the file
nblibraries.properties (available in each of the above locations) in <nblib>
- you will need to check for updates periodically and update your nblib manually - this is a one-click operation if you are using TortoiseSVN or another SVN client
- The first time you use each NetBeans project...
- Right click on Libraries and select Properties
- Near the top right, click on Browse on the line "Libraries folder"
- Browse to your <nblib> directory as above and click Next
- If it suggests some actions for referencing the libraries, accept the defaults and click Finish
- Replace any "missing" libraries by:
- Adding Library and selecting the appropriate one
- Removing the one that NetBeans marks as "missing"
- Finally, click OK.
Oracle Database drivers
If you need to access an Oracle database. Similar steps need to be followed if you are using any other database (except the built-in Apache Derby database).
- In the Services window, select Databases -> Drivers -> New Driver...
- Click Add and browse to where you have the Oracle database driver JAR (typically ojdbc14.jar) installed and select it. This may well be in <nblib>/jim.oracle/.
- A new driver (called "Oracle Thin") should appear in the list.
Resolving common problems
- This is usually caused by opening a project that was created elsewhere, and where the versions of Glassfish, Tomcat (or other server) are not the same.
- Easily resolved by right-clicking on a project and selecting Properties -> Run.
- Select an appropriate server.
- If you need Tomcat and do not have it installed, either:
- reinstall NetBeans making sure you customise the installation to include Tomcat; or
- install Tomcat separately and, once you have done that, use the Tools | Servers dialog in NetBeans to add it as a new server
Follow the instructions in "Libraries" above.
Use the "Resolve missing datasources" dialog.