| Java[tm] Smart Ticket Sample Application 2.0 Early Access > Building and Running the Sample Application |
Ant, a tool with similar functionality to make, is used to build the sample application, and to execute the binaries that are built. (Ant has been developed under the auspices of the Apache Software Foundation.) A working version of Ant is provided as part of the sample application bundle.
Before building the sample application, make sure your environment variables are set as specified in the installation instructions.
To build the sample application, bring up a shell or command
prompt, change the current directory to
{smart_ticket.dir}/src, and type:
build.sh <argument> (Solaris or
Linux)
build.bat <argument> (Windows)
The following table lists arguments you can use with the build
script in {smart_ticket.dir}/src, and what using each of
these arguments accomplishes.
| Argument | Purpose |
|---|---|
all |
Builds the entire application. (This is the default target.) |
clean |
Cleans out the build output directories. |
emulate |
Runs the MIDP client part in the emulator. |
cleandb |
Cleans the J2ME Wireless Toolkit RMS data store. |
deploy |
Deploys the J2EE server part on the J2EE SDK server. |
undeploy |
Undeploys the J2EE server part from the J2EE SDK server. |
When the build script is invoked with no arguments, it will build the entire application.
The client part of the application is placed in:
{smart_ticket.dir}/src/app/client/midp/build/
The server part of the application is placed in:
{smart_ticket.dir}/src/app/server/build/
To run the binaries produced by the build, use the build scripts. These instructions describe how to run the sample application using the J2EE SDK and the J2ME Wireless Toolkit on a single machine.
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're running the J2EE part of the application for the very first time, or if you've modified code in the J2EE part that accesses the database, follow these steps:
Generate the default SQL for the application, and deploy the application to the J2EE SDK server.
Bring up a command prompt.
Change the current directory to
{smart_ticket.dir}/src.
Enter the following command:
build.sh deploy (Solaris or
Linux)
build.bat deploy (Windows)
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.
If you've modified code in the J2ME part that accesses the local database (Record Management Store), or if the local database is out of sync with the database used by the J2EE part (for example, if you've redeployed the J2EE part of the application), follow these steps:
Bring up a command prompt.
Change the current directory to
{smart_ticket.dir}/src.
Enter the following command:
build.sh cleandb (Solaris or
Linux)
build.bat cleandb (Windows)
Run the MIDP part of the application.
Bring up a command prompt.
Change the current directory to
{smart_ticket.dir}/src.
Enter the following command:
build.sh emulate (Solaris or Linux)
build.bat emulate (Windows)
A phone emulator will appear, showing the Java Smart Ticket Sample Application splash screen.
You can now use the application.