klyn.ClassLoader.forName
method
public static forName(name as String) as Type
Description

Loads a class by its fully qualified name using the system loader.

Resolution follows the runtime class search order documented on ClassLoader: standard library, startup source directory, explicit -kp/--klasspath roots, $KLASSPATH, then current working directory. A successful lookup returns registered metadata for the requested class, never a placeholder for a missing class. Qualified names must match their package; ambiguous short names must be qualified explicitly. File-private types visible in the active source resolve to that source's declaration, not a namesake from another file.

Parameters
ParameterDescription
nameClass name to resolve.
Returns

Metadata of the loaded class.

Throws
  • ClassNotFoundException if the name is empty, ambiguous, or cannot be resolved and loaded.
Example
metadata = ClassLoader.forName("klyn.String")
assert metadata == String.type