ClassNotFoundException constructor

ClassNotFoundException(
  1. String className
)

A runtime exception in Jetleaf thrown when a requested class cannot be found by the runtime provider.

This typically occurs in scenarios where:

  • The class has not been registered with the runtime provider.
  • There is a typo in the requested class name.
  • The class is missing from the current ClassLoader or context.

Usage Example:

try {
  final clazz = Class.forName('NonExistentClass');
} on ClassNotFoundException catch (e) {
  print(e); 
  // Output: ClassNotFoundException: Class "NonExistentClass" was not found in the runtime provider.
}

Implementation

ClassNotFoundException(this.className) : super(
  'Class "$className" could not be found.\n'
  'This typically means:\n'
  ' • The class has not been registered with the runtime provider.\n'
  ' • A typo exists in the requested class name.\n'
  ' • The class is missing from the current ClassLoader context.\n',
);