Rationale

Installing a portal development environment on Windows is a bit of an adventure, due to all the interacting pieces, combined with Windows' famous tendency for being nonstandard and difficult. Therefore, I'm documenting what I've done and how I've done it, as a reference for myself, and putting it up in case it's useful for anybody else.

Install and configure Java and netbeans

[Note, you'll need administrator access to your machine in order to do this.]

Download a copy of netbeans from netbeans.org. This will give you an executable with a name like jdk-1_5_0_14-nb-5_5_1-win-ml.exe which, when run, will install the Java JDK, some JREs, and netbeans.

Add Subversion support to netbeans (optional)

Install Portal Pack plug-in to netbeans

Go to portalpack.netbeans.org and download the Portal Pack zip file (something like portal-pack-plugin-1_2.zip) and unzip it, which should yield three .nbm (netbeans module) files:

Run netbeans, go to Tools -> Update Center, and select "Install Manually Downloaded Modules (.nbm files)", and click on the Next button. On the following screen, click on the Add... button, navigate to your .nbm files, select them, and click the OK button. Once you've added them all, click on the Next button. Go through the next screens and install all of them. There will be a warning about unsigned modules, verify that you want to install them (you can save time by ticking the "apply to all" box).

Install glassfish application server

Download glassfish from glassfish.dev.java.net. Note that there are different installers for different operating systems, but when they're downloaded, they all share the name glassfish-installer-v2-b58g.jar. If you install the wrong one, you'll get an error like "could not find asenv.bat.template".

Set up environment

For the next step, ant will need to know where your Java JDK lives. If you get it wrong, it will return a misleading error instructing you to set java.home. This is actually a variable that Ant sets internally and "it is immutable". The real fix is to set the environment variable JAVA_HOME to point to your JDK installation. Ant will then derive java.home appropriately. To set JAVA_HOME, find out where your JDK got installed. On my system, it ended up at C:\Program Files\Java\jdk1.5.0_14. There will likely also be one or more directories named jre1.something-or-other. Don't use those. To set the environment variable, go to Start -> Control Panel. Double-click on the System icon. Click on the "Advanced" tab. Click on the "Environment Variables" button. Below the "User variables" panel (or the System Variables panel, if you want the changes to apply to other users of your machine), click the NEW button. In the "Variable name" box, put JAVA_HOME. In the "Variable value" box, put the path to your JDK. Click the "OK" button to exit the "New User Variable" dialog. Click the "OK" button to exit the "Environment Variables" dialog and update your environment. You may as well leave the "System Properties" window open, as you'll be returning to it later.

Install glassfish

To install glassfish, open a command window with ⌘-R (to open the Run dialog) and then run cmd. Change directory to your installer jar and type:
java -Xmx256m -jar glassfish-installer-v2-b58g.jar
Note that if java isn't on your path, you'll need to add it (procedure for modifying your path is below).
This creates a glassfish directory containing the installation files.

Set up glassfish

Change to the glassfish directory:
cd glassfish
Now you'll need to set up glassfish by running this ant command (using the ant that comes with glassfish):
lib\ant\bin\ant -f setup.xml
If this fails with a message saying you need to set java.home, scroll up and see if there's a message about being unable to find tools.jar. This message probably shows that ant was looking in a JRE directory, not the JDK directory where it really is. This usually means your JAVA_HOME environment variable was not properly set. Check this by typing:
echo %JAVA_HOME%
This should print out your JDK directory. If not, you'll need to go figure out why the JAVA_HOME environment variable isn't set correctly. Note that you'll have to exit from the Environment Variables dialog and open a new cmd window every time you change it, or the changes won't show up.

Start glassfish

To operate glassfish, you'll need to put it on your path. Your path is another environment variable which tells the computer where to find programs you want to run. Go back to your System Properties dialog and click the Environment Variables button again. Go to the System variables panel, select the Path entry, and click the "Edit" button. The "Variable value" box contains a (possibly quite long) list of directories, separated by semicolons. Go to the end of this, and append a semicolon and the path to your glassfish executables (this will be your glassfish directory followed by "\bin\". For my computer, I added this to the end of my Path string:
;C:\Documents and Settings\me\src\glassfish\bin\
Click on the OK button to close the "Edit System Variable" dialog, then the OK button to exit the "Enviroment Variables" dialog. You can go ahead and close the "System Properties" window too. Open a new cmd window (⌘-R cmd) and type:
asadmin start-domain domain1
This starts glassfish with its default domain (which is called domain1). This domain comes with the glassfish distribution and is likely the only one you'll need. You should get several messages about glassfish starting up.

Add the portlet container

Download the portlet container from portlet-container.dev.java.net. This will be a file like portlet-container-configurator.jar. Open a cmd window (⌘-R cmd), navigate to the directory where you stored the jar file, and type:
java -jar portlet-container-configurator.jar
This will open the installer window. The "Select Container" drop-down should read "Glassfish". You don't need to do anything with "Ant Home". Click on the "..." button next to the "Select Install Directory" box and navigate to your glassfish installation directory. The "Domain Directory" box should be auto-populated with the default domain (your glassfish directory with "\domains\domain1" appended). Click on the "Ok" button. It should refresh the Status: line indicating that the Portlet Container was installed, and the "Ok" button should be replaced with a "Quit" button. Exit the installer by clicking the "Quit" button.

Restart glassfish by typing in a command window:
asadmin stop-domain domain1
asadmin start-domain domain1
You should now be able to access your domain: http://localhost:8080/portletdriver/dt

Add Glassfish to netbeans

Go to Tools -> Server Manager. Click on the "Add Server..." button. Select "Sun Java System Application Server" as the Server. Set the name to anything you like (I used "Glassfish"). Click on the "Next >" button. Set the platform location to the directory where you installed Glassfish. Leave the "Register Local Default Domain" button checked. Click on the "Next >" button. Set an admin user name and password and click on the "Finish" button.

Add the portlet container to netbeans

Open the Server Manager window (as above) if it's not still open. Click on the "Add Server..." button. Set the server type to "Open Source Portlet Container" this time. Change the name if you like. Click on the "Next >" button. The server type is "GlassFish / Sun Java System AppServer 9". Navigate to or type in the glassfish installation directory in the "GlassFish Home:" box. It should auto-populate the rest of the boxes, except for the Password: and perhaps User Name:. Click on the "Next >" button. This will present you with a confirmation screen containing some useful information like your portlet container URIs. You may want to copy or write these down. Click "Finish".

Deploy your portlet

Now you should be able to load/create a portlet project in netbeans (File -> New Project..., Portlet Applications) and deploy it to your portlet (Run -> Run Main Project).

Note that ⌘ represents the "windows" or "command" key.