## Building a WAR/EAR file to include a self-contained JReport Enterprise Server

There are two ways of creating a WAR or EAR to include a self-contained JReport Enterprise Server:

- Create a WAR/EAR file using the provided tool makewar.bat/makewar.sh after you have installed a JReport Enterprise Server. If you are not familiar with JReport Enterprise Server, it is better to use this way.
- Create a WAR manually. The method is no longer needed but is still available in this release in case you would like to take it.

The self-contained JReport Enterprise Server is based on a library. The library contains all class packages required by the JReport Enterprise Server runtime, such as jrenv.jar, JRESServlets.jar, JREngine.jar, and JRWebDesign.jar. In the library, jrenv.jar contains the entire JReport runtime environment, and is the key to the self-contained integration solution. With the self-contained solution, you do not have to specify the JReport Enterprise Server installation root as the reporthome.

When you create a JReport Enterprise Server WAR/EAR file using the provided tool, the jrenv.jar package will be automatically put into the WAR/EAR, and will be extracted to the specified reporthome when initializing JReport Enterprise Server.

The following is the structure of the jrenv.jar package:

jrenv.jar

workspace/ -- This is the root folder.

bin/ -- This folder contains the license file jslc.dat and configuration files, such as LogConfig.properties and redirect.properties.

lib/ -- This folder contains jar files needed by applets, such as view12.jar and chart.jar.

template/ -- This folder contains template files.

profiling/report/ -- This folder contains profiling report set files.

jreports/ -- This folder contains demo report sets or pre-published report sets.

db/ -- This folder contains demo database for demo report sets.

help/ -- This folder contains help documents.

The bin/, lib/, and template/ folders are necessary for the JReport runtime, while the profiling/, jreports/, db/ and help/ folders are optional.

Note: There is a parameter in self-contained WAR/EAR - autoDetectServletPath. It is used to dynamically detect and modify servlet path based on context path of self-contained WAR/EAR when deploying the WAR/EAR to a J2EE application server. This property is enabled by default, and the actual servlet path will be concatenating "context path" with "default servlet path" set in server.properties. If you do not want this way, you can disable the feature using either of the following ways:

- Before making your WAR/EAR, set the parameter autoDetectServletPath to false in makewar.xml which is located in `<install_root>\bin`.
- If the WAR/EAR has already been built, go to web.xml, set this parameter autoDetectServletPath to false.

The following are topics covered in the section:

- Building a JReport Enterprise Server WAR/EAR by tool
- Building a JReport Enterprise Server WAR manually (deprecated)
- Four ways of integrating JReport Enterprise Server