Share via


URLClassLoader.Close Method

Definition

Closes this URLClassLoader, so that it can no longer be used to load new classes or resources that are defined by this loader.

[Android.Runtime.Register("close", "()V", "GetCloseHandler", ApiSince=24)]
public virtual void Close ();
[<Android.Runtime.Register("close", "()V", "GetCloseHandler", ApiSince=24)>]
abstract member Close : unit -> unit
override this.Close : unit -> unit

Implements

Attributes

Remarks

Closes this URLClassLoader, so that it can no longer be used to load new classes or resources that are defined by this loader. Classes and resources defined by any of this loader's parents in the delegation hierarchy are still accessible. Also, any classes or resources that are already loaded, are still accessible.

In the case of jar: and file: URLs, it also closes any files that were opened by it. If another thread is loading a class when the close method is invoked, then the result of that load is undefined.

The method makes a best effort attempt to close all opened files, by catching IOExceptions internally. Unchecked exceptions and errors are not caught. Calling close on an already closed loader has no effect.

Added in 1.7.

Java documentation for java.net.URLClassLoader.close().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to