Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    DelegateLastClassLoader
    class DelegateLastClassLoader : PathClassLoader
    
    A ClassLoader implementation that implements a delegate last lookup policy. For every class or resource this loader is requested to load, the following lookup order is employed: 
      
 
        - The boot classpath is always searched first
- Then, the list of dexfiles associated with this classloaders'sdexPathis searched.
- Finally, this classloader will delegate to the specified parent.
Summary
    
    
    
      
        
          | Protected methods | 
        
          | Class<*>! |  | 
      
    
    Public constructors
    
    
    
      DelegateLastClassLoader
      
      DelegateLastClassLoader(
    dexPath: String, 
    librarySearchPath: String?, 
    parent: ClassLoader?, 
    delegateResourceLoading: Boolean)
      Creates a DelegateLastClassLoader that operates on a given dexPath and a librarySearchPath. The dexPath should consist of one or more of the following, separated by File.pathSeparator, which is ":" on Android. 
        
 
          - JAR/ZIP/APK files, possibly containing a "classes.dex" file as well as arbitrary resources. 
- Raw ".dex" files (not inside a zip file). 
 Unlike 
PathClassLoader, this classloader will attempt to locate classes (or resources) using the following lookup order. 
        
 
          - The boot classpath is always searched first.
- Then, the list of dexfiles contained indexPathis searched./li>
- Lastly, this classloader will delegate to the specified parent.
 Note that this is in contrast to other standard classloaders that follow the delegation model. In those classloaders, the 
parent is always searched first. 
librarySearchPath specifies one more directories containing native library files, separated by 
File.pathSeparator.
      
        
          
            | Parameters | 
          
            | dexPath | String: the list of jar/apk files containing classes and resources, delimited by File.pathSeparator, which defaults to":"on Android. This value cannot benull. | 
          
            | librarySearchPath | String?: the list of directories containing native libraries, delimited by File.pathSeparator; may benull. | 
          
            | parent | ClassLoader?: the parent class loader. May be nullfor the boot classloader. | 
          
            | delegateResourceLoading | Boolean: whether to delegate resource loading to the parent if the resource is not found. This does not affect class loading delegation. | 
        
      
     
    Public methods
    
      getResource
      
      fun getResource(name: String!): URL!
      
        
          
            | Parameters | 
          
            | name | String!: The resource name | 
        
      
      
        
          
            | Return | 
          
            | URL! | URLobject for reading the resource;nullif the resource could not be found, aURLcould not be constructed to locate the resource, the resource is in a package that is not opened unconditionally, or access to the resource is denied by the security manager. | 
        
      
      
        
          
            | Exceptions | 
          
            | java.lang.NullPointerException | If nameisnull | 
        
      
     
    
      getResources
      
      fun getResources(name: String!): Enumeration<URL!>!
      
        
          
            | Parameters | 
          
            | name | String!: The resource name | 
        
      
      
        
          
            | Return | 
          
            | Enumeration<URL!>! | An enumeration of URLobjects for the resource. If no resources could be found, the enumeration will be empty. Resources for which aURLcannot be constructed, are in a package that is not opened unconditionally, or access to the resource is denied by the security manager, are not returned in the enumeration. | 
        
      
      
        
          
            | Exceptions | 
          
            | java.io.IOException | If I/O errors occur | 
          
            | java.lang.NullPointerException | If nameisnull | 
        
      
     
    Protected methods
    
      loadClass
      
      protected fun loadClass(
    name: String!, 
    resolve: Boolean
): Class<*>!
      
      
        
          
            | Return | 
          
            | Class<*>! | The resulting Classobject | 
        
      
      
        
          
            | Exceptions | 
          
            | java.lang.ClassNotFoundException | If the class could not be found | 
        
      
     
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  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.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]