Complete the steps listed under Installing a Java CAPS Runtime on a New Domain.
In NetBeans, open the Services window.
Right-click on Servers, and select Add Server.
The Add Server Instance Wizard appears.
Select GlassFish V2 and enter a unique name for the domain.
Click Next.
The Platform Folder Location window appears.
In the Platform Location field, enter the path to the application server home directory.
Select Register Local Default Domain, and select the domain you just created.
Click Next.
The Domain Admin Login Info window appears.
Enter the admin username and password, and then click Finish.
The new domain appears in the Servers list.