Good afternoon all,
I was wondering is there anyway to make the static block of a class run even when the class itself is not referenced?
I am aware that that it is lazily loaded such that simply calling any of the functions of that class will start initiating the class,
However I want the class to be initiated prior any calls, in other words I want it to run on JVM start regardless of whether or not it is referenced.
Preloading java classes/libraries at jar startup suggested a workaround, but its not really the solution I'm looking for (basically I don't want to need to do a Class.forName
, I want it to be done on JVM start)
How would we go about doing it?