The NetBeans project environment setup includes:
NetBeans 6.8 IDE
JDK 1.6
GlassFish v3 web server
JavaDB/Derby database
Java Pet Store Example in JAR
What do we have in this session?
In this short hands-on tutorial we will try to run Java Pet Store demo example in NetBeans 6.8 IDE. Java Pet Store demonstrates many Java technologies and in this tutorial we will see how the Data Access Object (DAO) was implemented.
Download Java Pet Store Demo Project JAR File
Firstly, download latest jar file for Java Pet Store demo project at: Java Pet Store Demo Project.
Uncompress the JAR File
Uncompress the jar file by double clicking the jar file or run the 'java -jar javapetstore-2.0-ea5-installer.jar' at the command line.
Accept the License Agreement. Click Accept.
The following are the files and folders of Java Pet Store.
Optional step: Copy the javapetstore-2.0-ea5 folder to C:\ drive (if needed) to make the path is shorter when used in the NetBeans project file and if you put the demo example in the other folder, make sure the path doesn’t have white space(s). White space in the path name will make the project failed to be built/run later.
Opening the Project in NetBeans IDE
Launch NetBeans (in this case version 6.8) IDE.
Open the Java pet store project in NetBeans. Click File menu > Open Project sub menu.
Select the Java pet store demo example project folder and click Open Project button.
Resolving Some Errors
Optional step: If you encounter the "target server error" (with errors in the project/files as shown below), complete the following steps, else just skip them until the "Glassfish server setup" section.
The "target server error" produces the following source code errors.
To resolve the "missing server problem", select the project folder in the Projects page > right click mouse > select Resolve Missing Server Problem menu.
------------------------------------------------------------
Select Glassfish v3 web server (or your desired web server) and click OK.
Removing and Re-installing Web Server in NetBeans
Optional step: Next, we have to make sure the Glassfish installation folder (and path) also doesn’t have whitespace(s) else the project building will fail. If your GlassFish installation folder (path) having whitespace(s) then remove the server and re-install it. The steps are shown in the following section. If the installation folder doesn’t have whitespace(s) then you can skip the following steps until the "modify the Glassfish root folder" section.
Firstly, remove the existing Glassfish web server. From NetBeans IDE, select Services tab > under the Servers folder, expand it > select the server that will be removed > right click mouse > select Remove context menu.
Then, 're-install' the Glassfish v3 web server. In the Services page select Servers folder > right click mouse > select Add Server menu.
From Add Server Instance page, select GlassFish v3 from Server: text box > click Next.
You need to create the sges-v3 folder manually (in this case at C: drive) and then point the Installation Location: to C:\sges-v3. Select the license agreement and click the Download Now button. This is an online installation/update.
Wait until the online installation complete.
After the online installation finish, click the Next button.
Select domain1 (default first domain) as the domain and click Finish button.
Back to Main | java Pet Store 2