Stay organized with collections
Save and categorize content based on your preferences.
ClassNotFoundException
open class ClassNotFoundException : ReflectiveOperationException
Thrown when an application tries to load in a class through its string name using:
- The
forName
method in class Class
.
- The
findSystemClass
method in class ClassLoader
.
- The
loadClass
method in class ClassLoader
.
but no definition for the class with the specified name could be found.
Summary
Public constructors |
Constructs a ClassNotFoundException with no detail message.
|
Constructs a ClassNotFoundException with the specified detail message.
|
Constructs a ClassNotFoundException with the specified detail message and optional exception that was raised while loading the class.
|
Public methods |
open Throwable! |
Returns the exception that was raised if an error occurred while attempting to load the class.
|
Public constructors
ClassNotFoundException
ClassNotFoundException()
Constructs a ClassNotFoundException
with no detail message.
ClassNotFoundException
ClassNotFoundException(s: String!)
Constructs a ClassNotFoundException
with the specified detail message.
Parameters |
s |
String!: the detail message. |
ClassNotFoundException
ClassNotFoundException(
s: String!,
ex: Throwable!)
Constructs a ClassNotFoundException
with the specified detail message and optional exception that was raised while loading the class.
Parameters |
s |
String!: the detail message |
ex |
Throwable!: the exception that was raised while loading the class |
Public methods
getException
open fun getException(): Throwable!
Returns the exception that was raised if an error occurred while attempting to load the class. Otherwise, returns null
.
Return |
Throwable! |
the Exception that was raised while loading a class |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ClassNotFoundException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nClassNotFoundException\n======================\n\n```\nopen class ClassNotFoundException : ReflectiveOperationException\n```\n\n|---|---|---|---|---------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||\n| | ↳ | [java.lang.Exception](/reference/kotlin/java/lang/Exception) |||\n| | | ↳ | [java.lang.ReflectiveOperationException](/reference/kotlin/java/lang/ReflectiveOperationException) ||\n| | | | ↳ | [java.lang.ClassNotFoundException](#) |\n\nThrown when an application tries to load in a class through its string name using:\n\n- The `forName` method in class `Class`.\n- The `findSystemClass` method in class `ClassLoader` .\n- The `loadClass` method in class `ClassLoader`.\n\n\u003cbr /\u003e\n\nbut no definition for the class with the specified name could be found.\n\nSummary\n-------\n\n| Public constructors ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [ClassNotFoundException](#ClassNotFoundException())`()` Constructs a `ClassNotFoundException` with no detail message. |\n| [ClassNotFoundException](#ClassNotFoundException(kotlin.String))`(`s:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs a `ClassNotFoundException` with the specified detail message. |\n| [ClassNotFoundException](#ClassNotFoundException(kotlin.String,%20kotlin.Throwable))`(`s:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `ex:` `[Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!`)` Constructs a `ClassNotFoundException` with the specified detail message and optional exception that was raised while loading the class. |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| open [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)! | [getException](#getException())`()` Returns the exception that was raised if an error occurred while attempting to load the class. |\n\nPublic constructors\n-------------------\n\n### ClassNotFoundException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nClassNotFoundException()\n```\n\nConstructs a `ClassNotFoundException` with no detail message. \n\n### ClassNotFoundException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nClassNotFoundException(s: String!)\n```\n\nConstructs a `ClassNotFoundException` with the specified detail message.\n\n| Parameters ||\n|-----|--------------------------------------------------------------------------------------------------------|\n| `s` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the detail message. |\n\n### ClassNotFoundException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nClassNotFoundException(\n s: String!, \n ex: Throwable!)\n```\n\nConstructs a `ClassNotFoundException` with the specified detail message and optional exception that was raised while loading the class.\n\n| Parameters ||\n|------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| `s` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the detail message |\n| `ex` | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!: the exception that was raised while loading the class |\n\nPublic methods\n--------------\n\n### getException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getException(): Throwable!\n```\n\nReturns the exception that was raised if an error occurred while attempting to load the class. Otherwise, returns `null`.\n\n| Return ||\n|-----------------------------------------------------------------------------------------|-------------------------------------------------------|\n| [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)! | the `Exception` that was raised while loading a class |"]]