| Java[tm] Smart Ticket Sample Application 2.0 Early Access > Running the Pre-Built Sample Application |
These instructions describe how to run the sample application using the J2EE SDK and the J2ME Wireless Toolkit on a single machine. The sample application bundle includes pre-built binaries that you can use to run the sample application. If you make any modifications to the source code, you'll need to follow a different set of instructions on building the application.
Start the Cloudscape database server, which comes with the J2EE SDK.
Bring up a command prompt.
Change the current directory to $J2EE_HOME/bin
(Linux or Solaris) or %J2EE_HOME%\bin (Windows
NT/2000).
Enter the following command:
cloudscape -start
Start the J2EE Reference Implementation server, which comes with the J2EE SDK.
Bring up a command prompt.
Change the current directory to $J2EE_HOME/bin
(Linux or Solaris) or %J2EE_HOME%\bin (Windows
NT/2000).
Enter the following command:
j2ee -noJMS
If you are running the J2EE part of the application for the very first time, follow these steps:
Deploy the J2EE part of the application (this can also be achieved using the setup script - see below)
Open the J2EE part of the application with the J2EE RI deployment tool.
Bring up a command prompt.
Change the current directory to $J2EE_HOME/bin
(Linux or Solaris) or %J2EE_HOME%\bin
(Windows NT/2000).
Enter the following command:
deploytool
From the File menu, select Open....
Using the subsequent file dialog, go to {smart_ticket.dir}
and open smart_ticket.ear.
Generate the default SQL for the application.
Double-click the SmartTicketJAR entry to reveal its beans.
Click the AccountBean. (You could select any other entity bean, but the AccountBean will suffice.)
In the inspector panel on the right, click the Entity tab.
Click Deployment Settings. A new window will appear.
Click Generate Default SQL. When the SQL generation is complete, a dialog will appear.
Click OK to dismiss the dialog.
Click OK to dismiss the Deployment Settings window.
Deploy the application.
Select the SmartTicket-1_2 entry from the left pane, if it is not already selected.
From the Tools menu, select Deploy....
Click Finish. A window showing the deployment's progress will appear, and let you know when it is complete.
When the deployment is finished, click OK.
Populate the Cloudscape database with the sample application's data.
Using your Web browser, visit http://localhost:8000/smartticket/.
If your browser is configured to use a proxy, make sure
that your browser does not use the proxy to access localhost.
Click the link to populate the database. This
link points to http://localhost:8000/smartticket/admin/populating.jsp?forcefully=false.
The browser will let you know when the database has
been successfully populated.
Run the MIDP part of the application using the J2ME Wireless Toolkit (this can also be achieved using the setup script- see below).
If you are using Solaris or Linux:
Bring up a shell prompt.
Change the current directory to {smart_ticket.dir}
.
Enter the following command:
$J2MEWTK_HOME/bin/emulator
-Xdescriptor:smart_ticket-client.jad
If you are using Windows:
From the Start menu, select Programs > J2ME Wireless Toolkit 2.0 > Run MIDP Application....
Using the subsequent file dialog, go to {smart_ticket.dir}
and open smart_ticket-client.jad.
A phone emulator will appear, showing the Java Smart Ticket Sample Application splash screen.
You can now use the application.
Most of step 3 and all of step 4 above can be executed using a setup script in the sample application bundle.
Bring up a shell or command prompt, change the current directory to
{smart_ticket.dir}, and type:
setup.sh <argument>
(Solaris or Linux)
setup.bat <argument>
(Windows)
The following table lists arguments you can use with the setup
script in {smart_ticket.dir}, and what using each of
these arguments accomplishes.
| Argument | Purpose |
|---|---|
all |
Setup the entire application. (This is the default target.) You still must populate the application's database as explained in step 4b above. |
deploy |
Deploys the J2EE server part on the J2EE SDK server. You still must populate the application's database as explained in step 4b above. |
emulate |
Runs the MIDP client part in the emulator. |
cleandb |
Cleans the J2ME Wireless Toolkit RMS data store. |
undeploy |
Undeploys the J2EE server part from the J2EE SDK server. |