I'm building a Java package and I need some initialization code to be called in order for the package to work properly. The package is being wrapped up as a .jar
, and I have no control over what the user will be calling when they import my package into their application. Rather than having them need to call an initialization method before they can start using my package, is there any way for this method to be called under the hood?
I'd also like to mention that the static { }
approach won't work, as I need this code to be called one time regardless of which objects in the package are being utilized.