JBoss.org Community Documentation

21.2. Java Archives (JARs)

The JARStructure class determines whether a deployment, in the form of a file or a directory, represents a packaged or unpackaged JAR archive. If the deployment is a single file then the filename suffix is checked against a list contained in the JarUtils class:

  • .zip - a standard archive

  • .jar - a java archive (defined by the Java SE specification)

  • .ear - an enterprise archive (defined by the Java EE specification)

  • .rar - a resource archive (defined by the Java EE specification)

  • .war - a web archive (defined by the Java EE specification)

  • .sar - a service archive (defined by JBoss)

  • .har - a hibernate archive (defined by JBoss)

  • .aop - an aspect archive (defined by JBoss)

If the deployment is a directory then the same check is performed using the directory name. If a match is found in either case then the deployment is determined to represent a JAR archive.


A top-level directory whose name doesn't match any of the file suffixes is still considered an unpackaged JAR archive as this allows it to be used as a container for multiple nested deployments.

In order to detect nested JAR deployments we iterate through all subdirectories checking whether their names end in a known suffix or if they contain META-INF directories. The check for a META-INF directory is required otherwise every subdirectory without a known filename would be classified as a nested deployment.

For each JAR deployment found we create a new ContextInfo object with its metadata path set to META-INF and the classpath set to the deployment root.