This line is run at the top level, so it is run before the Construct runtime exists, therefore runtime
cannot be used. The runtime only exists when the callback to runOnStartup()
is executed. So you have to wait until at least that point in time or later before trying to use the runtime.
A typical way to do that is to declare the global variable as set to null
initially, and then assign it later on.