Java Platform, Enterprise Edition (Java EE) 8 The Java EE Tutorial

## Creating Resources Administratively

Before you deploy or run many applications, you may need to create resources for them. An application can include a `glassfish-resources.xml` file that can be used to define resources for that application and others. You can then use the `asadmin` command, specifying as the argument a file named `glassfish-resources.xml`, to create the resources administratively, as shown.

    asadmin add-resources glassfish-resources.xml

The `glassfish-resources.xml` file can be created in any project using NetBeans IDE or by hand. Some of the JMS examples use this approach to resource creation. A file for creating the resources needed for the JMS simple producer example can be found in the `jms/simple/producer/src/main/setup` directory.

You could also use the `asadmin create-jms-resource` command to create the resources for this example. When you are done using the resources, you would use the `asadmin list-jms-resources` command to display their names, and the `asadmin delete-jms-resource` command to remove them, regardless of the way you created the resources.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.