Main Class


A module which is defined with a “main-class” element is said to be executable. In other words, the module name can be listed on the command line, and the standard static main(String[]) method in the named module’s “main-class” will be loaded and executed.


Let’s discover all the methods using directly or indirectly the ConcreteModuleSpec.mainClass field:


from m in Methods
let depth0 = m.DepthOfIsUsing(“org.jboss.modules.ConcreteModuleSpec.mainClass”)
where depth0 >= 0 orderby depth0
select new { m, depth0 }

jboss module 


Many methods use it specially loadModule which needs to execute it if it’s assigned.



In order for a module to actually have content, you must define the “resources” element with at least one resource root.

A resource root is a specification of a location where the class loader for a module will look for classes and resources. Each module has zero or more resource roots, though most regular modules will contain exactly one, which refers to the JAR file with the module’s content.

A resource is defined in the code base by the interface Resource, Let’s search for all classes implementing it.


from t in Types where t.Implement (“org.jboss.modules.Resource”)
select new { t, t.NbBCInstructions }


jboss module 


The resource could be defined by a jar, a path or a URL path containing the jars.


The modules API exposes a method which can read property (string key-value pair) values from a module. To specify values for these properties you use the “properties” element which can contain zero or more “property” elements.


A module may express one or more dependencies on other module(s) via the “dependencies” element.

A dependency is defined by the Dependency class which is an abstract class, here are all dependencies classes inheriting from it.


jboss module 

Let’s search for all methods using directly the Dependency class.


from m in Methods where m.IsUsing (“org.jboss.modules.Dependency”)
select new { m, m.NbBCInstructions }


jboss module 

The methods addPaths and addExportedPaths treat all the dependencies specified in the module descriptor, and we can search for all types used by addPaths.

from t in Types where t.IsUsedBy (“org.jboss.modules.Module.addPaths(Dependency[],Map,FastCopyHashSet,FastCopyHashSet,FastCopyHashSet,Set)”)
select new { t, t.NbBCInstructions }


As shown in the dependency graph this method uses the dependencies and also the filters specified in the module descriptor to assign all possible module dependencies.


Related articles available on

JBoss AS 7 introduction

This is an introduction tutorial to the newest JBoss AS 7 which a

Develop Java EE applications on WildFly

In this tutorial we will learn how to develop a basic Java EE 8 a

Adding users with JBoss AS 7

If you are planning to add new users to your management interface

Using JBoss AS 7 management API programmatically

In this tutorial we will show how to use detyped management API t

JNDI view in JBoss AS 7

JNDI can be checked on the naming subsystem of the application se

How to install a module on WildFly / JBoss AS 7

Installing a module on WildFly / JBoss AS 7 requires creating a p