1 *java.lang.ClassLoader* *ClassLoader* A class loader is an object that is respon
3 public abstract class ClassLoader
4 extends |java.lang.Object|
6 |java.lang.ClassLoader_Description|
7 |java.lang.ClassLoader_Fields|
8 |java.lang.ClassLoader_Constructors|
9 |java.lang.ClassLoader_Methods|
11 ================================================================================
13 *java.lang.ClassLoader_Constructors*
14 |java.lang.ClassLoader()|Creates a new class loader using the ClassLoader retur
15 |java.lang.ClassLoader(ClassLoader)|Creates a new class loader using the specif
17 *java.lang.ClassLoader_Methods*
18 |java.lang.ClassLoader.clearAssertionStatus()|Sets the default assertion status
19 |java.lang.ClassLoader.defineClass(byte[],int,int)|Converts an array of bytes i
20 |java.lang.ClassLoader.defineClass(String,byte[],int,int)|Converts an array of
21 |java.lang.ClassLoader.defineClass(String,byte[],int,int,ProtectionDomain)|Conv
22 |java.lang.ClassLoader.defineClass(String,ByteBuffer,ProtectionDomain)|Converts
23 |java.lang.ClassLoader.definePackage(String,String,String,String,String,String,String,URL)|
24 |java.lang.ClassLoader.findClass(String)|Finds the class with the specified bin
25 |java.lang.ClassLoader.findLibrary(String)|Returns the absolute path name of a
26 |java.lang.ClassLoader.findLoadedClass(String)|Returns the class with the given
27 |java.lang.ClassLoader.findResource(String)|Finds the resource with the given n
28 |java.lang.ClassLoader.findResources(String)|Returns an enumeration ofjava.net.
29 |java.lang.ClassLoader.findSystemClass(String)|Finds a class with the specified
30 |java.lang.ClassLoader.getPackage(String)|Returns a Package that has been defin
31 |java.lang.ClassLoader.getPackages()|Returns all of the Packages defined by thi
32 |java.lang.ClassLoader.getParent()|Returns the parent class loader for delegati
33 |java.lang.ClassLoader.getResource(String)|Finds the resource with the given na
34 |java.lang.ClassLoader.getResourceAsStream(String)|Returns an input stream for
35 |java.lang.ClassLoader.getResources(String)|Finds all the resources with the gi
36 |java.lang.ClassLoader.getSystemClassLoader()|Returns the system class loader f
37 |java.lang.ClassLoader.getSystemResource(String)|Find a resource of the specifi
38 |java.lang.ClassLoader.getSystemResourceAsStream(String)|Open for reading, a re
39 |java.lang.ClassLoader.getSystemResources(String)|Finds all resources of the sp
40 |java.lang.ClassLoader.loadClass(String)|Loads the class with the specified bin
41 |java.lang.ClassLoader.loadClass(String,boolean)|Loads the class with the speci
42 |java.lang.ClassLoader.resolveClass(Class<?>)|Links the specified class.
43 |java.lang.ClassLoader.setClassAssertionStatus(String,boolean)|Sets the desired
44 |java.lang.ClassLoader.setDefaultAssertionStatus(boolean)|Sets the default asse
45 |java.lang.ClassLoader.setPackageAssertionStatus(String,boolean)|Sets the packa
46 |java.lang.ClassLoader.setSigners(Class<?>,Object[])|Sets the signers of a clas
48 *java.lang.ClassLoader_Description*
50 A class loader is an object that is responsible for loading classes. The class
51 ClassLoader is an abstract class. Given the binary name of a class, a class
52 loader should attempt to locate or generate data that constitutes a definition
53 for the class. A typical strategy is to transform the name into a file name and
54 then read a "class file" of that name from a file system.
56 Every <tt>Class</tt>(|java.lang.Class|) object contains a
57 reference(|java.lang.Class|) to the ClassLoader that defined it.
59 Class objects for array classes are not created by class loaders, but are
60 created automatically as required by the Java runtime. The class loader for an
61 array class, as returned by (|java.lang.Class|) is the same as the class loader
62 for its element type; if the element type is a primitive type, then the array
63 class has no class loader.
65 Applications implement subclasses of ClassLoader in order to extend the manner
66 in which the Java virtual machine dynamically loads classes.
68 Class loaders may typically be used by security managers to indicate security
71 The ClassLoader class uses a delegation model to search for classes and
72 resources. Each instance of ClassLoader has an associated parent class loader.
73 When requested to find a class or resource, a ClassLoader instance will
74 delegate the search for the class or resource to its parent class loader before
75 attempting to find the class or resource itself. The virtual machine's built-in
76 class loader, called the "bootstrap class loader", does not itself have a
77 parent but may serve as the parent of a ClassLoader instance.
79 Normally, the Java virtual machine loads classes from the local file system in
80 a platform-dependent manner. For example, on UNIX systems, the virtual machine
81 loads classes from the directory defined by the CLASSPATH environment variable.
83 However, some classes may not originate from a file; they may originate from
84 other sources, such as the network, or they could be constructed by an
85 application. The method <tt>defineClass</tt>(|java.lang.ClassLoader|) converts
86 an array of bytes into an instance of class Class. Instances of this newly
87 defined class can be created using
88 <tt>Class.newInstance</tt>(|java.lang.Class|) .
90 The methods and constructors of objects created by a class loader may reference
91 other classes. To determine the class(es) referred to, the Java virtual machine
92 invokes the <tt>loadClass</tt>(|java.lang.ClassLoader|) method of the class
93 loader that originally created the class.
95 For example, an application could create a network class loader to download
96 class files from a server. Sample code might look like:
100 ClassLoader loader= new NetworkClassLoader(host,port); Object main=
101 loader.loadClass("Main", true).newInstance(); ...
103 The network class loader subclass must define the methods
104 <tt>findClass</tt>(|java.lang.ClassLoader|) and loadClassData to load a class
105 from the network. Once it has downloaded the bytes that make up the class, it
106 should use the method <tt>defineClass</tt>(|java.lang.ClassLoader|) to create a
107 class instance. A sample implementation is:
111 class NetworkClassLoader extends ClassLoader { String host; int port;
113 public Class findClass(String name) { byte[] b = loadClassData(name); return
114 defineClass(name, b, 0, b.length); }
116 private byte[] loadClassData(String name) { // load the class data from the
121 Any class name provided as a (|java.lang.String|) parameter to methods in
122 ClassLoader must be a binary name as defined by the Java Language
125 Examples of valid class names include:
127 "java.lang.String" "javax.swing.JSpinner$DefaultEditor"
128 "java.security.KeyStore$Builder$FileBuilder$1" "java.net.URLClassLoader$3$1"
132 *java.lang.ClassLoader()*
134 protected ClassLoader()
136 Creates a new class loader using the ClassLoader returned by the method
137 <tt>getSystemClassLoader()</tt>(|java.lang.ClassLoader|) as the parent class
140 If there is a security manager, its
141 <tt>checkCreateClassLoader</tt>(|java.lang.SecurityManager|) method is invoked.
142 This may result in a security exception.
145 *java.lang.ClassLoader(ClassLoader)*
147 protected ClassLoader(java.lang.ClassLoader parent)
149 Creates a new class loader using the specified parent class loader for
152 If there is a security manager, its
153 <tt>checkCreateClassLoader</tt>(|java.lang.SecurityManager|) method is invoked.
154 This may result in a security exception.
156 parent - The parent class loader
158 *java.lang.ClassLoader.clearAssertionStatus()*
160 public synchronized void clearAssertionStatus()
162 Sets the default assertion status for this class loader to false and discards
163 any package defaults or class assertion status settings associated with the
164 class loader. This method is provided so that class loaders can be made to
165 ignore any command line or persistent assertion status settings and "start with
170 *java.lang.ClassLoader.defineClass(byte[],int,int)*
172 protected final |java.lang.Class|<?> defineClass(
176 throws |java.lang.ClassFormatError|
178 Converts an array of bytes into an instance of class Class. Before the Class
179 can be used it must be resolved. This method is deprecated in favor of the
180 version that takes a binary name as its first argument, and is more secure.
182 Deprecated: Replaced by {@link #defineClass(String, byte[], int, int)
183 defineClass(String, byte[], int, int)}
185 b - The bytes that make up the class data. The bytes in positions off through
186 off+len-1 should have the format of a valid class file as defined by the
187 Java Virtual Machine Specification.
188 off - The start offset in b of the class data
189 len - The length of the class data
191 Returns: The Class object that was created from the specified class data
193 *java.lang.ClassLoader.defineClass(String,byte[],int,int)*
195 protected final |java.lang.Class|<?> defineClass(
196 java.lang.String name,
200 throws |java.lang.ClassFormatError|
202 Converts an array of bytes into an instance of class Class. Before the Class
203 can be used it must be resolved.
205 This method assigns a default
206 <tt>ProtectionDomain</tt>(|java.security.ProtectionDomain|) to the newly
207 defined class. The ProtectionDomain is effectively granted the same set of
208 permissions returned when <tt>Policy.getPolicy().getPermissions(new
209 CodeSource(null, null))</tt>(|java.security.Policy|) is invoked. The default
210 domain is created on the first invocation of
211 <tt>defineClass</tt>(|java.lang.ClassLoader|) , and re-used on subsequent
214 To assign a specific ProtectionDomain to the class, use the
215 <tt>defineClass</tt>(|java.lang.ClassLoader|) method that takes a
216 ProtectionDomain as one of its arguments.
219 name - The expected binary name of the class, or null if not known
220 b - The bytes that make up the class data. The bytes in positions off through
221 off+len-1 should have the format of a valid class file as defined by the
222 Java Virtual Machine Specification.
223 off - The start offset in b of the class data
224 len - The length of the class data
226 Returns: The Class object that was created from the specified class data.
228 *java.lang.ClassLoader.defineClass(String,byte[],int,int,ProtectionDomain)*
230 protected final |java.lang.Class|<?> defineClass(
231 java.lang.String name,
235 java.security.ProtectionDomain protectionDomain)
236 throws |java.lang.ClassFormatError|
238 Converts an array of bytes into an instance of class Class, with an optional
239 ProtectionDomain. If the domain is null, then a default domain will be assigned
240 to the class as specified in the documentation for (|java.lang.ClassLoader|) .
241 Before the class can be used it must be resolved.
243 The first class defined in a package determines the exact set of certificates
244 that all subsequent classes defined in that package must contain. The set of
245 certificates for a class is obtained from the
246 <tt>CodeSource</tt>(|java.security.CodeSource|) within the ProtectionDomain of
247 the class. Any classes added to that package must contain the same set of
248 certificates or a SecurityException will be thrown. Note that if name is null,
249 this check is not performed. You should always pass in the binary name of the
250 class you are defining as well as the bytes. This ensures that the class you
251 are defining is indeed the class you think it is.
253 The specified name cannot begin with "java.", since all classes in the "java.*
254 packages can only be defined by the bootstrap class loader. If name is not
255 null, it must be equal to the binary name of the class specified by the byte
256 array "b", otherwise a (|null|) will be thrown.
259 name - The expected binary name of the class, or null if not known
260 b - The bytes that make up the class data. The bytes in positions off through
261 off+len-1 should have the format of a valid class file as defined by the
262 Java Virtual Machine Specification.
263 off - The start offset in b of the class data
264 len - The length of the class data
265 protectionDomain - The ProtectionDomain of the class
267 Returns: The Class object created from the data, and optional ProtectionDomain.
269 *java.lang.ClassLoader.defineClass(String,ByteBuffer,ProtectionDomain)*
271 protected final |java.lang.Class|<?> defineClass(
272 java.lang.String name,
273 java.nio.ByteBuffer b,
274 java.security.ProtectionDomain protectionDomain)
275 throws |java.lang.ClassFormatError|
277 Converts a <tt>ByteBuffer</tt>(|java.nio.ByteBuffer|) into an instance of class
278 Class, with an optional ProtectionDomain. If the domain is null, then a default
279 domain will be assigned to the class as specified in the documentation for
280 (|java.lang.ClassLoader|) . Before the class can be used it must be resolved.
282 The rules about the first class defined in a package determining the set of
283 certificates for the package, and the restrictions on class names are identical
284 to those specified in the documentation for (|java.lang.ClassLoader|) .
286 An invocation of this method of the form cl.defineClass(name, bBuffer, pd)
287 yields exactly the same result as the statements
289 ... byte[] temp = new byte[bBuffer. remaining(|java.nio.ByteBuffer|) ()];
290 bBuffer. get(|java.nio.ByteBuffer|) (temp); return
291 </tt><i>cl</i><tt>.defineClass(|java.lang.ClassLoader|) (name, temp, 0,
295 name - The expected binary namenull if not known
296 b - The bytes that make up the class data. The bytes from positions b.position()
297 through b.position() + b.limit() -1 should have the format of a valid
298 class file as defined by the Java Virtual Machine Specification.
299 protectionDomain - The ProtectionDomain of the class, or null.
301 Returns: The Class object created from the data, and optional ProtectionDomain.
303 *java.lang.ClassLoader.definePackage(String,String,String,String,String,String,String,URL)*
305 protected |java.lang.Package| definePackage(
306 java.lang.String name,
307 java.lang.String specTitle,
308 java.lang.String specVersion,
309 java.lang.String specVendor,
310 java.lang.String implTitle,
311 java.lang.String implVersion,
312 java.lang.String implVendor,
313 java.net.URL sealBase)
314 throws |java.lang.IllegalArgumentException|
316 Defines a package by name in this ClassLoader. This allows class loaders to
317 define the packages for their classes. Packages must be created before the
318 class is defined, and package names must be unique within a class loader and
319 cannot be redefined or changed once created.
322 name - The package name
323 specTitle - The specification title
324 specVersion - The specification version
325 specVendor - The specification vendor
326 implTitle - The implementation title
327 implVersion - The implementation version
328 implVendor - The implementation vendor
329 sealBase - If not null, then this package is sealed with respect to the given code source
330 {@link java.net.URL URL} object. Otherwise, the package is not sealed.
332 Returns: The newly defined Package object
334 *java.lang.ClassLoader.findClass(String)*
336 protected |java.lang.Class|<?> findClass(java.lang.String name)
337 throws |java.lang.ClassNotFoundException|
339 Finds the class with the specified binary name. This method should be
340 overridden by class loader implementations that follow the delegation model for
341 loading classes, and will be invoked by the
342 <tt>loadClass</tt>(|java.lang.ClassLoader|) method after checking the parent
343 class loader for the requested class. The default implementation throws a
344 ClassNotFoundException.
347 name - The binary name of the class
349 Returns: The resulting Class object
351 *java.lang.ClassLoader.findLibrary(String)*
353 protected |java.lang.String| findLibrary(java.lang.String libname)
355 Returns the absolute path name of a native library. The VM invokes this method
356 to locate the native libraries that belong to classes loaded with this class
357 loader. If this method returns null, the VM searches the library along the path
358 specified as the "java.library.path" property.
361 libname - The library name
363 Returns: The absolute path of the native library
365 *java.lang.ClassLoader.findLoadedClass(String)*
367 protected final |java.lang.Class|<?> findLoadedClass(java.lang.String name)
369 Returns the class with the given binary name if this loader has been recorded
370 by the Java virtual machine as an initiating loader of a class with that binary
371 name. Otherwise null is returned.
374 name - The binary name of the class
376 Returns: The Class object, or null if the class has not been loaded
378 *java.lang.ClassLoader.findResource(String)*
380 protected |java.net.URL| findResource(java.lang.String name)
382 Finds the resource with the given name. Class loader implementations should
383 override this method to specify where to find resources.
386 name - The resource name
388 Returns: A URL object for reading the resource, or null if the resource could not be
391 *java.lang.ClassLoader.findResources(String)*
393 protected |java.util.Enumeration|<URL> findResources(java.lang.String name)
394 throws |java.io.IOException|
396 Returns an enumeration of <tt>URL</tt>(|java.net.URL|) objects representing all
397 the resources with the given name. Class loader implementations should override
398 this method to specify where to load resources from.
401 name - The resource name
403 Returns: An enumeration of {@link java.net.URL URL} objects for the resources
405 *java.lang.ClassLoader.findSystemClass(String)*
407 protected final |java.lang.Class|<?> findSystemClass(java.lang.String name)
408 throws |java.lang.ClassNotFoundException|
410 Finds a class with the specified binary name, loading it if necessary.
412 This method loads the class through the system class loader (see
413 (|java.lang.ClassLoader|) ). The Class object returned might have more than one
414 ClassLoader associated with it. Subclasses of ClassLoader need not usually
415 invoke this method, because most class loaders need to override just
416 (|java.lang.ClassLoader|) .
419 name - The binary name of the class
421 Returns: The Class object for the specified name
423 *java.lang.ClassLoader.getPackage(String)*
425 protected |java.lang.Package| getPackage(java.lang.String name)
427 Returns a Package that has been defined by this class loader or any of its
431 name - The package name
433 Returns: The Package corresponding to the given name, or null if not found
435 *java.lang.ClassLoader.getPackages()*
437 protected |java.lang.Package|[] getPackages()
439 Returns all of the Packages defined by this class loader and its ancestors.
443 Returns: The array of Package objects defined by this ClassLoader
445 *java.lang.ClassLoader.getParent()*
447 public final |java.lang.ClassLoader| getParent()
449 Returns the parent class loader for delegation. Some implementations may use
450 null to represent the bootstrap class loader. This method will return null in
451 such implementations if this class loader's parent is the bootstrap class
454 If a security manager is present, and the invoker's class loader is not null
455 and is not an ancestor of this class loader, then this method invokes the
456 security manager's <tt>checkPermission</tt>(|java.lang.SecurityManager|) method
458 <tt>RuntimePermission("getClassLoader")</tt>(|java.lang.RuntimePermission|)
459 permission to verify access to the parent class loader is permitted. If not, a
460 SecurityException will be thrown.
464 Returns: The parent ClassLoader
466 *java.lang.ClassLoader.getResource(String)*
468 public |java.net.URL| getResource(java.lang.String name)
470 Finds the resource with the given name. A resource is some data (images, audio,
471 text, etc) that can be accessed by class code in a way that is independent of
472 the location of the code.
474 The name of a resource is a '/'-separated path name that identifies the
477 This method will first search the parent class loader for the resource; if the
478 parent is null the path of the class loader built-in to the virtual machine is
479 searched. That failing, this method will invoke (|java.lang.ClassLoader|) to
483 name - The resource name
485 Returns: A URL object for reading the resource, or null if the resource could not be
486 found or the invoker doesn't have adequate privileges to get the
489 *java.lang.ClassLoader.getResourceAsStream(String)*
491 public |java.io.InputStream| getResourceAsStream(java.lang.String name)
493 Returns an input stream for reading the specified resource.
495 The search order is described in the documentation for
496 (|java.lang.ClassLoader|) .
499 name - The resource name
501 Returns: An input stream for reading the resource, or null if the resource could not be
504 *java.lang.ClassLoader.getResources(String)*
506 public |java.util.Enumeration|<URL> getResources(java.lang.String name)
507 throws |java.io.IOException|
509 Finds all the resources with the given name. A resource is some data (images,
510 audio, text, etc) that can be accessed by class code in a way that is
511 independent of the location of the code.
513 The name of a resource is a /-separated path name that identifies the resource.
515 The search order is described in the documentation for
516 (|java.lang.ClassLoader|) .
519 name - The resource name
521 Returns: An enumeration of {@link java.net.URL URL} objects for the resource. If no
522 resources could be found, the enumeration will be empty. Resources
523 that the class loader doesn't have access to will not be in the
526 *java.lang.ClassLoader.getSystemClassLoader()*
528 public static |java.lang.ClassLoader| getSystemClassLoader()
530 Returns the system class loader for delegation. This is the default delegation
531 parent for new ClassLoader instances, and is typically the class loader used to
532 start the application.
534 This method is first invoked early in the runtime's startup sequence, at which
535 point it creates the system class loader and sets it as the context class
536 loader of the invoking Thread.
538 The default system class loader is an implementation-dependent instance of this
541 If the system property "java.system.class.loader" is defined when this method
542 is first invoked then the value of that property is taken to be the name of a
543 class that will be returned as the system class loader. The class is loaded
544 using the default system class loader and must define a public constructor that
545 takes a single parameter of type ClassLoader which is used as the delegation
546 parent. An instance is then created using this constructor with the default
547 system class loader as the parameter. The resulting class loader is defined to
548 be the system class loader.
550 If a security manager is present, and the invoker's class loader is not null
551 and the invoker's class loader is not the same as or an ancestor of the system
552 class loader, then this method invokes the security manager's
553 <tt>checkPermission</tt>(|java.lang.SecurityManager|) method with a
554 <tt>RuntimePermission("getClassLoader")</tt>(|java.lang.RuntimePermission|)
555 permission to verify access to the system class loader. If not, a
556 SecurityException will be thrown.
560 Returns: The system ClassLoader for delegation, or null if none
562 *java.lang.ClassLoader.getSystemResource(String)*
564 public static |java.net.URL| getSystemResource(java.lang.String name)
566 Find a resource of the specified name from the search path used to load
567 classes. This method locates the resource through the system class loader (see
568 (|java.lang.ClassLoader|) ).
571 name - The resource name
573 Returns: A {@link java.net.URL URL} object for reading the resource, or null if the
574 resource could not be found
576 *java.lang.ClassLoader.getSystemResourceAsStream(String)*
578 public static |java.io.InputStream| getSystemResourceAsStream(java.lang.String name)
580 Open for reading, a resource of the specified name from the search path used to
581 load classes. This method locates the resource through the system class loader
582 (see (|java.lang.ClassLoader|) ).
585 name - The resource name
587 Returns: An input stream for reading the resource, or null if the resource could not be
590 *java.lang.ClassLoader.getSystemResources(String)*
592 public static |java.util.Enumeration|<URL> getSystemResources(java.lang.String name)
593 throws |java.io.IOException|
595 Finds all resources of the specified name from the search path used to load
596 classes. The resources thus found are returned as an
597 <tt>Enumeration</tt>(|java.util.Enumeration|) of <tt>URL</tt>(|java.net.URL|)
600 The search order is described in the documentation for
601 (|java.lang.ClassLoader|) .
604 name - The resource name
606 Returns: An enumeration of resource {@link java.net.URL URL} objects
608 *java.lang.ClassLoader.loadClass(String)*
610 public |java.lang.Class|<?> loadClass(java.lang.String name)
611 throws |java.lang.ClassNotFoundException|
613 Loads the class with the specified binary name. This method searches for
614 classes in the same manner as the (|java.lang.ClassLoader|) method. It is
615 invoked by the Java virtual machine to resolve class references. Invoking this
616 method is equivalent to invoking <tt>loadClass(name,
617 false)</tt>(|java.lang.ClassLoader|) .
620 name - The binary name of the class
622 Returns: The resulting Class object
624 *java.lang.ClassLoader.loadClass(String,boolean)*
626 protected synchronized |java.lang.Class|<?> loadClass(
627 java.lang.String name,
629 throws |java.lang.ClassNotFoundException|
631 Loads the class with the specified binary name. The default implementation of
632 this method searches for classes in the following order:
636 Invoke (|java.lang.ClassLoader|) to check if the class has already been loaded.
638 Invoke the <tt>loadClass</tt>(|java.lang.ClassLoader|) method on the parent
639 class loader. If the parent is null the class loader built-in to the virtual
640 machine is used, instead.
642 Invoke the (|java.lang.ClassLoader|) method to find the class.
646 If the class was found using the above steps, and the resolve flag is true,
647 this method will then invoke the (|java.lang.ClassLoader|) method on the
648 resulting Class object.
650 Subclasses of ClassLoader are encouraged to override (|java.lang.ClassLoader|)
651 , rather than this method.
654 name - The binary name of the class
655 resolve - If true then resolve the class
657 Returns: The resulting Class object
659 *java.lang.ClassLoader.resolveClass(Class<?>)*
661 protected final void resolveClass(java.lang.Class<?> c)
663 Links the specified class. This (misleadingly named) method may be used by a
664 class loader to link a class. If the class c has already been linked, then this
665 method simply returns. Otherwise, the class is linked as described in the
666 "Execution" chapter of the Java Language Specification.
669 c - The class to link
671 *java.lang.ClassLoader.setClassAssertionStatus(String,boolean)*
673 public synchronized void setClassAssertionStatus(
674 java.lang.String className,
677 Sets the desired assertion status for the named top-level class in this class
678 loader and any nested classes contained therein. This setting takes precedence
679 over the class loader's default assertion status, and over any applicable
680 per-package default. This method has no effect if the named class has already
681 been initialized. (Once a class is initialized, its assertion status cannot
684 If the named class is not a top-level class, this invocation will have no
685 effect on the actual assertion status of any class.
688 className - The fully qualified class name of the top-level class whose assertion status is
690 enabled - true if the named class is to have assertions enabled when (and if) it is
691 initialized, false if the class is to have assertions disabled.
693 *java.lang.ClassLoader.setDefaultAssertionStatus(boolean)*
695 public synchronized void setDefaultAssertionStatus(boolean enabled)
697 Sets the default assertion status for this class loader. This setting
698 determines whether classes loaded by this class loader and initialized in the
699 future will have assertions enabled or disabled by default. This setting may be
700 overridden on a per-package or per-class basis by invoking
701 (|java.lang.ClassLoader|) or (|java.lang.ClassLoader|) .
704 enabled - true if classes loaded by this class loader will henceforth have assertions
705 enabled by default, false if they will have assertions disabled by
708 *java.lang.ClassLoader.setPackageAssertionStatus(String,boolean)*
710 public synchronized void setPackageAssertionStatus(
711 java.lang.String packageName,
714 Sets the package default assertion status for the named package. The package
715 default assertion status determines the assertion status for classes
716 initialized in the future that belong to the named package or any of its
719 A subpackage of a package named p is any package whose name begins with "p.".
720 For example, javax.swing.text is a subpackage of javax.swing, and both
721 java.util and java.lang.reflect are subpackages of java.
723 In the event that multiple package defaults apply to a given class, the package
724 default pertaining to the most specific package takes precedence over the
725 others. For example, if javax.lang and javax.lang.reflect both have package
726 defaults associated with them, the latter package default applies to classes in
729 Package defaults take precedence over the class loader's default assertion
730 status, and may be overridden on a per-class basis by invoking
731 (|java.lang.ClassLoader|) .
734 packageName - The name of the package whose package default assertion status is to be set. A
735 null value indicates the unnamed package that is "current" (Java
736 Language Specification, section 7.4.2).
737 enabled - true if classes loaded by this classloader and belonging to the named package
738 or any of its subpackages will have assertions enabled by default, false
739 if they will have assertions disabled by default.
741 *java.lang.ClassLoader.setSigners(Class<?>,Object[])*
743 protected final void setSigners(
744 java.lang.Class<?> c,
745 java.lang.Object[] signers)
747 Sets the signers of a class. This should be invoked after defining a class.
751 signers - The signers for the class