# The Java EE 7 Tutorial

# 46 Java Message Service Examples

This chapter provides examples that show how to use the JMS API in various kinds of Java EE applications. It covers the following topics:

- Overview of the JMS Examples

- Writing Simple JMS Applications

- Writing More Advanced JMS Applications

- Writing High Performance and Scalable JMS Applications

- Sending and Receiving Messages Using a Simple Web Application

- Receiving Messages Asynchronously Using a Message-Driven Bean

- Sending Messages from a Session Bean to an MDB

- Using an Entity to Join Messages from Two MDBs

- Using NetBeans IDE to Create JMS Resources

A final section covers Using NetBeans IDE to Create JMS Resources.

The examples are in the tut-install`/examples/jms/` directory.

The steps to build and run each example are as follows.

1. Use NetBeans IDE or Maven to compile, package, and in some cases deploy the example.

2. Use NetBeans IDE, Maven, or the `appclient` command to run the application client, or use the browser to run the web application examples.

Before you deploy or run the examples, you need to create resources for them. Some examples have a `glassfish-resources.xml` file that is used to create resources for that example and others. You can use the `asadmin` command to create the resources.

To use the `asadmin` and `appclient` commands, you need to put the GlassFish Server `bin` directories in your command path, as described in SDK Installation Tips.