Enterprise web programming

Modules ENTWA (Level 6) and APSW (Level 7)

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.

Installation

  1. 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.
  2. If you have previously installed NetBeans, you may already have an earlier version of Glassfish installed. You may wish to uninstall this before proceeding.
  3. Install NetBeans. During installation:
    1. Ensure that on the list of packs and runtimes to install includes at least:
      1. Java SE
      2. Common Web Components
      3. Java Web and EE
      4. Glassfish

Installation locations

Installation folder for Abbreviation used in notes below Typical location (on my system at least!)
NetBeans <netbeans> C:\Program Files\NetBeans 8.0.1
Java <java> C:\Program Files\Java\jdk1.8.0_20
Glassfish <glassfish> C:\Program Files\glassfish-4.0

Configuration

Importing settings from a previous version

  1. 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.
    1. 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

  1. If not already enabled,
    1. View | Show line numbers
    2. View | Toolbars | Debug

Plug-in preferences

Some plug-ins that are installed by default are superfluous and can be removed:

  1. Tools | Plugins | Installed
  2. Click on the following to mark them for uninstallation (unless you actually use these systems for version control):
    1. Mercurial
    2. CVS
    3. Git
  3. Tools | Plugins | Available
  4. Install the following (if they are not already installed):
    1. Subversion (essential for the course)
    2. JIRA (useful)
    3. Team Server (useful)

Libraries

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:
  1. If you are running NetBeans on a University PC or connected to the University network (e.g. using WebDrive):
    1. the necessary library files can be found at K:\Student\Technology\Computing\BriggsJ\jars\Nblib
    2. libraries will be updated periodically and updates will be included in your project(s) automatically the next time you use NetBeans
  2. If you are running NetBeans elsewhere, or on a University PC that does not provide access to the K: drive:
    1. create a folder <nblib> (e.g. My Documents\nblib or N:\nblib) to act as a central repository for your library files
    2. the necessary library files can either be:
      1. [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.
      2. copied from K:\Student\Technology\Computing\BriggsJ\jars\Nblib to <nblib>
    3. ensure that your copy includes the file nblibraries.properties (available in each of the above locations) in <nblib>
    4. 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
  3. The first time you use each NetBeans project...
    1. Right click on Libraries and select Properties
    2. Near the top right, click on Browse on the line "Libraries folder"
    3. Browse to your <nblib> directory as above and click Next
    4. If it suggests some actions for referencing the libraries, accept the defaults and click Finish
    5. Replace any "missing" libraries by:
      1. Adding Library and selecting the appropriate one
      2. Removing the one that NetBeans marks as "missing"
    6. 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).

  1. In the Services window, select Databases -> Drivers -> New Driver...
  2. 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/.
  3. A new driver (called "Oracle Thin") should appear in the list.

Resolving common problems

Missing server

  1. 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.
  2. Easily resolved by right-clicking on a project and selecting Properties -> Run.
  3. Select an appropriate server.
  4. If you need Tomcat and do not have it installed, either:
    1. reinstall NetBeans making sure you customise the installation to include Tomcat; or
    2. install Tomcat separately and, once you have done that, use the Tools | Servers dialog in NetBeans to add it as a new server

Missing libraries

Follow the instructions in "Libraries" above.

Missing datasources

Use the "Resolve missing datasources" dialog.

 

Last updated by Prof Jim Briggs of the School of Computing at the University of Portsmouth

 
The enterprise web programming modules include some material that was formerly part of the WEB1P and WEB2P units.