Register the main class to a global variable.