The Java Backend

This page explains how to generate Java code from ABS sources and how to execute the generated Java code.

Generating Java Code

Java code can be generated by running the following command:

java -cp absfrontend.jar <options> <ABS files>

For example to compile the files A.abs and B.abs one would write:

java -cp absfrontend.jar A.abs B.abs

This will generate the java files in a folder named "gen". This folder can be changed using the "-d" parameter. The destination folder has to be created manually.


The following parameters can be used, when generating Java code:

print version
verbose output
build given product by applying deltas (PID is the qualified product ID)
disable typechecking
do not include the standard lib
enable location type checking
sets the default location type to loctype where loctype in [Far, Near, Somewhere, Infer]
sets the location aliasing scope to scope where scope in [BASIC, METHOD_LOCAL_FAR, CLASS_LOCAL_FAR, COMPILATION_UNIT_LOCAL_FAR, MODULE_LOCAL_FAR, GLOBAL_FAR]
dump AST to standard output
solve constraint satisfaction problem (CSP) for the feature model
get ALL solutions for the CSP
count the number of solutions
ignore the attributes
check satisfiability of a product with qualified name PID
print this help message
-d dir
generate files to dir
print stacktrace on exception
do not generate class files

Executing Generated Java Code

To execute the generated Java Code use:

java -cp gen:absfrontend.jar <ModuleName>.Main [options]

On windows systems you have to use a semicolon instead of a colon as classpath seperator.

The module name must refer to an ABS module with a main block. If the module does not exist or does not have a main block you will see a NoClassDefFoundError exception.


The following parameters can be used, when executing generated Java code:

shows help information
enables the use of ABS-NET
enables debugging
starts the graphical debugger
terminates the system when an exception occurs
comma-separated list of system observer classes. Implementations of SystemObserver:
sets a total scheduler class. Implementations of TotalSchedulingStrategy:
sets a global scheduler class. Can use the same classes as the totalscheduler option.
sets a task scheduler strategy class
sets the task scheduler to be used. Either "default" or "simple".
enables recording of task scheduling
set the random seed used by schedulers
sets the random scheduler as the total scheduler
prints that used random seed to stdout
sets the logging level
comma-separated list of classes to be logged
sets a filter class for scheduable tasks. Possible options are:
  • (default)
  • (guarantees message ordering between two COGs)