public class ClassInitializer
extends java.lang.Object
This utility class allows for initialization of all classes at startup to avoid initialization delays at an innapropriate time.
Note: Users might want to disable logging when initializing run-time
classes at start-up because of the presence of old classes (never used)
in the jar files for which initialization fails. For example:
public static main(String[] args) {
LogContext.enter(LogContext.NULL); // Temporarely disables logging errors and warnings.
try {
ClassInitializer.initializeAll(); // Initializes bootstrap, extensions and classpath classes.
} finally {
LogContext.exit(LogContext.NULL); // Goes back to default logging.
}
...
}
Modifier and Type | Method and Description |
---|---|
static void |
initialize(java.lang.Class cls)
Initializes the specified class.
|
static void |
initialize(java.lang.String className)
Initializes the class with the specified name.
|
static void |
initializeAll()
Initializes all runtime and classpath classes.
|
static void |
initializeClassPath()
Initializes all classes in current classpath.
|
static void |
initializeDir(java.lang.String dirName)
Initializes all the classes in the specified directory.
|
static void |
initializeJar(java.lang.String jarName)
Initializes all the classes in the specified jar file.
|
static void |
initializeRuntime()
Initializes runtime classes (bootstrap classes in
System.getProperty("sun.boot.class.path")) and the
extension .jar in lib/ext directory). |
public static void initializeAll()
initializeRuntime()
,
initializeClassPath()
public static void initializeRuntime()
System.getProperty("sun.boot.class.path"))
and the
extension .jar
in lib/ext
directory).public static void initializeClassPath()
public static void initialize(java.lang.Class cls)
cls
- the class to initialize.public static void initialize(java.lang.String className)
className
- the name of the class to initialize.public static void initializeJar(java.lang.String jarName)
jarName
- the jar filename.public static void initializeDir(java.lang.String dirName)
dirName
- the name of the directory containing the classes to
initialize.Copyright © 2005 - 2007 Javolution.