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 class.
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"
131 *java.lang.ClassLoader()*
133 protected ClassLoader()
135 Creates a new class loader using the ClassLoader returned by the method
136 <tt>getSystemClassLoader()</tt>(|java.lang.ClassLoader|) as the parent class
139 If there is a security manager, its
140 <tt>checkCreateClassLoader</tt>(|java.lang.SecurityManager|) method is invoked.
141 This may result in a security exception.
144 *java.lang.ClassLoader(ClassLoader)*
146 protected ClassLoader(java.lang.ClassLoader parent)
148 Creates a new class loader using the specified parent class loader for
151 If there is a security manager, its
152 <tt>checkCreateClassLoader</tt>(|java.lang.SecurityManager|) method is invoked.
153 This may result in a security exception.
155 parent - The parent class loader
157 *java.lang.ClassLoader.clearAssertionStatus()*
159 public synchronized void clearAssertionStatus()
161 Sets the default assertion status for this class loader to false and discards
162 any package defaults or class assertion status settings associated with the
163 class loader. This method is provided so that class loaders can be made to
164 ignore any command line or persistent assertion status settings and "start with
168 *java.lang.ClassLoader.defineClass(byte[],int,int)*
170 protected final |java.lang.Class| defineClass(
174 throws |java.lang.ClassFormatError|
176 Converts an array of bytes into an instance of class Class. Before the Class
177 can be used it must be resolved. This method is deprecated in favor of the
178 version that takes a binary name as its first argument, and is more secure.
180 b - The bytes that make up the class data. The bytes in positions off through
181 off+len-1 should have the format of a valid class file as defined by the
182 Java Virtual Machine Specification.
183 off - The start offset in b of the class data
184 len - The length of the class data
186 Returns: The Class object that was created from the specified class data
187 *java.lang.ClassLoader.defineClass(String,byte[],int,int)*
189 protected final |java.lang.Class| defineClass(
190 java.lang.String name,
194 throws |java.lang.ClassFormatError|
196 Converts an array of bytes into an instance of class Class. Before the Class
197 can be used it must be resolved.
199 This method assigns a default
200 <tt>ProtectionDomain</tt>(|java.security.ProtectionDomain|) to the newly
201 defined class. The ProtectionDomain is effectively granted the same set of
202 permissions returned when <tt>Policy.getPolicy().getPermissions(new
203 CodeSource(null, null))</tt>(|java.security.Policy|) is invoked. The default
204 domain is created on the first invocation of
205 <tt>defineClass</tt>(|java.lang.ClassLoader|) , and re-used on subsequent
208 To assign a specific ProtectionDomain to the class, use the
209 <tt>defineClass</tt>(|java.lang.ClassLoader|) method that takes a
210 ProtectionDomain as one of its arguments.
212 name - The expected binary name of the class, or null if not known
213 b - The bytes that make up the class data. The bytes in positions off through
214 off+len-1 should have the format of a valid class file as defined by the
215 Java Virtual Machine Specification.
216 off - The start offset in b of the class data
217 len - The length of the class data
219 Returns: The Class object that was created from the specified class data.
220 *java.lang.ClassLoader.defineClass(String,byte[],int,int,ProtectionDomain)*
222 protected final |java.lang.Class| defineClass(
223 java.lang.String name,
227 java.security.ProtectionDomain protectionDomain)
228 throws |java.lang.ClassFormatError|
230 Converts an array of bytes into an instance of class Class, with an optional
231 ProtectionDomain. If the domain is null, then a default domain will be assigned
232 to the class as specified in the documentation for (|java.lang.ClassLoader|) .
233 Before the class can be used it must be resolved.
235 The first class defined in a package determines the exact set of certificates
236 that all subsequent classes defined in that package must contain. The set of
237 certificates for a class is obtained from the
238 <tt>CodeSource</tt>(|java.security.CodeSource|) within the ProtectionDomain of
239 the class. Any classes added to that package must contain the same set of
240 certificates or a SecurityException will be thrown. Note that if name is null,
241 this check is not performed. You should always pass in the binary name of the
242 class you are defining as well as the bytes. This ensures that the class you
243 are defining is indeed the class you think it is.
245 The specified name cannot begin with "java.", since all classes in the "java.*
246 packages can only be defined by the bootstrap class loader. If name is not
247 null, it must be equal to the binary name of the class specified by the byte
248 array "b", otherwise a (|null|) will be thrown.
250 name - The expected binary name of the class, or null if not known
251 b - The bytes that make up the class data. The bytes in positions off through
252 off+len-1 should have the format of a valid class file as defined by the
253 Java Virtual Machine Specification.
254 off - The start offset in b of the class data
255 len - The length of the class data
256 protectionDomain - The ProtectionDomain of the class
258 Returns: The Class object created from the data, and optional ProtectionDomain.
259 *java.lang.ClassLoader.defineClass(String,ByteBuffer,ProtectionDomain)*
261 protected final |java.lang.Class| defineClass(
262 java.lang.String name,
263 java.nio.ByteBuffer b,
264 java.security.ProtectionDomain protectionDomain)
265 throws |java.lang.ClassFormatError|
267 Converts a <tt>ByteBuffer</tt>(|java.nio.ByteBuffer|) into an instance of class
268 Class, with an optional ProtectionDomain. If the domain is null, then a default
269 domain will be assigned to the class as specified in the documentation for
270 (|java.lang.ClassLoader|) . Before the class can be used it must be resolved.
272 The rules about the first class defined in a package determining the set of
273 certificates for the package, and the restrictions on class names are identical
274 to those specified in the documentation for (|java.lang.ClassLoader|) .
276 An invocation of this method of the form cl.defineClass(name, bBuffer, pd)
277 yields exactly the same result as the statements
279 ... byte[] temp = new byte[bBuffer. remaining(|java.nio.ByteBuffer|) ()];
280 bBuffer. get(|java.nio.ByteBuffer|) (temp); return
281 </tt><i>cl</i><tt>.defineClass(|java.lang.ClassLoader|) (name, temp, 0,
284 name - The expected binary namenull if not known
285 b - The bytes that make up the class data. The bytes from positions b.position()
286 through b.position() + b.limit() -1 should have the format of a valid
287 class file as defined by the Java Virtual Machine Specification.
288 protectionDomain - The ProtectionDomain of the class, or null.
290 Returns: The Class object created from the data, and optional ProtectionDomain.
291 *java.lang.ClassLoader.definePackage(String,String,String,String,String,String,String,URL)*
293 protected |java.lang.Package| definePackage(
294 java.lang.String name,
295 java.lang.String specTitle,
296 java.lang.String specVersion,
297 java.lang.String specVendor,
298 java.lang.String implTitle,
299 java.lang.String implVersion,
300 java.lang.String implVendor,
301 java.net.URL sealBase)
302 throws |java.lang.IllegalArgumentException|
304 Defines a package by name in this ClassLoader. This allows class loaders to
305 define the packages for their classes. Packages must be created before the
306 class is defined, and package names must be unique within a class loader and
307 cannot be redefined or changed once created.
309 name - The package name
310 specTitle - The specification title
311 specVersion - The specification version
312 specVendor - The specification vendor
313 implTitle - The implementation title
314 implVersion - The implementation version
315 implVendor - The implementation vendor
316 sealBase - If not null, then this package is sealed with respect to the given code source
317 {@link java.net.URL URL} object. Otherwise, the package is not sealed.
319 Returns: The newly defined Package object
320 *java.lang.ClassLoader.findClass(String)*
322 protected |java.lang.Class| findClass(java.lang.String name)
323 throws |java.lang.ClassNotFoundException|
325 Finds the class with the specified binary name. This method should be
326 overridden by class loader implementations that follow the delegation model for
327 loading classes, and will be invoked by the
328 <tt>loadClass</tt>(|java.lang.ClassLoader|) method after checking the parent
329 class loader for the requested class. The default implementation throws a
330 ClassNotFoundException.
332 name - The binary name of the class
334 Returns: The resulting Class object
335 *java.lang.ClassLoader.findLibrary(String)*
337 protected |java.lang.String| findLibrary(java.lang.String libname)
339 Returns the absolute path name of a native library. The VM invokes this method
340 to locate the native libraries that belong to classes loaded with this class
341 loader. If this method returns null, the VM searches the library along the path
342 specified as the "java.library.path" property.
344 libname - The library name
346 Returns: The absolute path of the native library
347 *java.lang.ClassLoader.findLoadedClass(String)*
349 protected final |java.lang.Class| findLoadedClass(java.lang.String name)
351 Returns the class with the given binary name if this loader has been recorded
352 by the Java virtual machine as an initiating loader of a class with that binary
353 name. Otherwise null is returned.
355 name - The binary name of the class
357 Returns: The Class object, or null if the class has not been loaded
358 *java.lang.ClassLoader.findResource(String)*
360 protected |java.net.URL| findResource(java.lang.String name)
362 Finds the resource with the given name. Class loader implementations should
363 override this method to specify where to find resources.
365 name - The resource name
367 Returns: A URL object for reading the resource, or null if the resource could not be
369 *java.lang.ClassLoader.findResources(String)*
371 protected |java.util.Enumeration| findResources(java.lang.String name)
372 throws |java.io.IOException|
374 Returns an enumeration of <tt>URL</tt>(|java.net.URL|) objects representing all
375 the resources with the given name. Class loader implementations should override
376 this method to specify where to load resources from.
378 name - The resource name
380 Returns: An enumeration of {@link java.net.URL URL} objects for the resources
381 *java.lang.ClassLoader.findSystemClass(String)*
383 protected final |java.lang.Class| findSystemClass(java.lang.String name)
384 throws |java.lang.ClassNotFoundException|
386 Finds a class with the specified binary name, loading it if necessary.
388 This method loads the class through the system class loader (see
389 (|java.lang.ClassLoader|) ). The Class object returned might have more than one
390 ClassLoader associated with it. Subclasses of ClassLoader need not usually
391 invoke this method, because most class loaders need to override just
392 (|java.lang.ClassLoader|) .
394 name - The binary name of the class
396 Returns: The Class object for the specified name
397 *java.lang.ClassLoader.getPackage(String)*
399 protected |java.lang.Package| getPackage(java.lang.String name)
401 Returns a Package that has been defined by this class loader or any of its
404 name - The package name
406 Returns: The Package corresponding to the given name, or null if not found
407 *java.lang.ClassLoader.getPackages()*
409 protected |java.lang.Package| getPackages()
411 Returns all of the Packages defined by this class loader and its ancestors.
414 Returns: The array of Package objects defined by this ClassLoader
415 *java.lang.ClassLoader.getParent()*
417 public final |java.lang.ClassLoader| getParent()
419 Returns the parent class loader for delegation. Some implementations may use
420 null to represent the bootstrap class loader. This method will return null in
421 such implementations if this class loader's parent is the bootstrap class
424 If a security manager is present, and the invoker's class loader is not null
425 and is not an ancestor of this class loader, then this method invokes the
426 security manager's <tt>checkPermission</tt>(|java.lang.SecurityManager|) method
428 <tt>RuntimePermission("getClassLoader")</tt>(|java.lang.RuntimePermission|)
429 permission to verify access to the parent class loader is permitted. If not, a
430 SecurityException will be thrown.
433 Returns: The parent ClassLoader
434 *java.lang.ClassLoader.getResource(String)*
436 public |java.net.URL| getResource(java.lang.String name)
438 Finds the resource with the given name. A resource is some data (images, audio,
439 text, etc) that can be accessed by class code in a way that is independent of
440 the location of the code.
442 The name of a resource is a '/'-separated path name that identifies the
445 This method will first search the parent class loader for the resource; if the
446 parent is null the path of the class loader built-in to the virtual machine is
447 searched. That failing, this method will invoke (|java.lang.ClassLoader|) to
450 name - The resource name
452 Returns: A URL object for reading the resource, or null if the resource could not be
453 found or the invoker doesn't have adequate privileges to get the
455 *java.lang.ClassLoader.getResourceAsStream(String)*
457 public |java.io.InputStream| getResourceAsStream(java.lang.String name)
459 Returns an input stream for reading the specified resource.
461 The search order is described in the documentation for
462 (|java.lang.ClassLoader|) .
464 name - The resource name
466 Returns: An input stream for reading the resource, or null if the resource could not be
468 *java.lang.ClassLoader.getResources(String)*
470 public |java.util.Enumeration| getResources(java.lang.String name)
471 throws |java.io.IOException|
473 Finds all the resources with the given name. A resource is some data (images,
474 audio, text, etc) that can be accessed by class code in a way that is
475 independent of the location of the code.
477 The name of a resource is a /-separated path name that identifies the resource.
479 The search order is described in the documentation for
480 (|java.lang.ClassLoader|) .
482 name - The resource name
484 Returns: An enumeration of {@link java.net.URL URL} objects for the resource. If no
485 resources could be found, the enumeration will be empty. Resources
486 that the class loader doesn't have access to will not be in the
488 *java.lang.ClassLoader.getSystemClassLoader()*
490 public static |java.lang.ClassLoader| getSystemClassLoader()
492 Returns the system class loader for delegation. This is the default delegation
493 parent for new ClassLoader instances, and is typically the class loader used to
494 start the application.
496 This method is first invoked early in the runtime's startup sequence, at which
497 point it creates the system class loader and sets it as the context class
498 loader of the invoking Thread.
500 The default system class loader is an implementation-dependent instance of this
503 If the system property "java.system.class.loader" is defined when this method
504 is first invoked then the value of that property is taken to be the name of a
505 class that will be returned as the system class loader. The class is loaded
506 using the default system class loader and must define a public constructor that
507 takes a single parameter of type ClassLoader which is used as the delegation
508 parent. An instance is then created using this constructor with the default
509 system class loader as the parameter. The resulting class loader is defined to
510 be the system class loader.
512 If a security manager is present, and the invoker's class loader is not null
513 and the invoker's class loader is not the same as or an ancestor of the system
514 class loader, then this method invokes the security manager's
515 <tt>checkPermission</tt>(|java.lang.SecurityManager|) method with a
516 <tt>RuntimePermission("getClassLoader")</tt>(|java.lang.RuntimePermission|)
517 permission to verify access to the system class loader. If not, a
518 SecurityException will be thrown.
521 Returns: The system ClassLoader for delegation, or null if none
522 *java.lang.ClassLoader.getSystemResource(String)*
524 public static |java.net.URL| getSystemResource(java.lang.String name)
526 Find a resource of the specified name from the search path used to load
527 classes. This method locates the resource through the system class loader (see
528 (|java.lang.ClassLoader|) ).
530 name - The resource name
532 Returns: A {@link java.net.URL URL} object for reading the resource, or null if the
533 resource could not be found
534 *java.lang.ClassLoader.getSystemResourceAsStream(String)*
536 public static |java.io.InputStream| getSystemResourceAsStream(java.lang.String name)
538 Open for reading, a resource of the specified name from the search path used to
539 load classes. This method locates the resource through the system class loader
540 (see (|java.lang.ClassLoader|) ).
542 name - The resource name
544 Returns: An input stream for reading the resource, or null if the resource could not be
546 *java.lang.ClassLoader.getSystemResources(String)*
548 public static |java.util.Enumeration| getSystemResources(java.lang.String name)
549 throws |java.io.IOException|
551 Finds all resources of the specified name from the search path used to load
552 classes. The resources thus found are returned as an
553 <tt>Enumeration</tt>(|java.util.Enumeration|) of <tt>URL</tt>(|java.net.URL|)
556 The search order is described in the documentation for
557 (|java.lang.ClassLoader|) .
559 name - The resource name
561 Returns: An enumeration of resource {@link java.net.URL URL} objects
562 *java.lang.ClassLoader.loadClass(String)*
564 public |java.lang.Class| loadClass(java.lang.String name)
565 throws |java.lang.ClassNotFoundException|
567 Loads the class with the specified binary name. This method searches for
568 classes in the same manner as the (|java.lang.ClassLoader|) method. It is
569 invoked by the Java virtual machine to resolve class references. Invoking this
570 method is equivalent to invoking <tt>loadClass(name,
571 false)</tt>(|java.lang.ClassLoader|) .
573 name - The binary name of the class
575 Returns: The resulting Class object
576 *java.lang.ClassLoader.loadClass(String,boolean)*
578 protected synchronized |java.lang.Class| loadClass(
579 java.lang.String name,
581 throws |java.lang.ClassNotFoundException|
583 Loads the class with the specified binary name. The default implementation of
584 this method searches for classes in the following order:
588 Invoke (|java.lang.ClassLoader|) to check if the class has already been loaded.
590 Invoke the <tt>loadClass</tt>(|java.lang.ClassLoader|) method on the parent
591 class loader. If the parent is null the class loader built-in to the virtual
592 machine is used, instead.
594 Invoke the (|java.lang.ClassLoader|) method to find the class.
598 If the class was found using the above steps, and the resolve flag is true,
599 this method will then invoke the (|java.lang.ClassLoader|) method on the
600 resulting Class object.
602 Subclasses of ClassLoader are encouraged to override (|java.lang.ClassLoader|)
603 , rather than this method.
605 name - The binary name of the class
606 resolve - If true then resolve the class
608 Returns: The resulting Class object
609 *java.lang.ClassLoader.resolveClass(Class)*
611 protected final void resolveClass(java.lang.Class c)
613 Links the specified class. This (misleadingly named) method may be used by a
614 class loader to link a class. If the class c has already been linked, then this
615 method simply returns. Otherwise, the class is linked as described in the
616 "Execution" chapter of the Java Language Specification.
618 c - The class to link
620 *java.lang.ClassLoader.setClassAssertionStatus(String,boolean)*
622 public synchronized void setClassAssertionStatus(
623 java.lang.String className,
626 Sets the desired assertion status for the named top-level class in this class
627 loader and any nested classes contained therein. This setting takes precedence
628 over the class loader's default assertion status, and over any applicable
629 per-package default. This method has no effect if the named class has already
630 been initialized. (Once a class is initialized, its assertion status cannot
633 If the named class is not a top-level class, this invocation will have no
634 effect on the actual assertion status of any class, and its return value is
637 className - The fully qualified class name of the top-level class whose assertion status is
639 enabled - true if the named class is to have assertions enabled when (and if) it is
640 initialized, false if the class is to have assertions disabled.
642 *java.lang.ClassLoader.setDefaultAssertionStatus(boolean)*
644 public synchronized void setDefaultAssertionStatus(boolean enabled)
646 Sets the default assertion status for this class loader. This setting
647 determines whether classes loaded by this class loader and initialized in the
648 future will have assertions enabled or disabled by default. This setting may be
649 overridden on a per-package or per-class basis by invoking
650 (|java.lang.ClassLoader|) or (|java.lang.ClassLoader|) .
652 enabled - true if classes loaded by this class loader will henceforth have assertions
653 enabled by default, false if they will have assertions disabled by
656 *java.lang.ClassLoader.setPackageAssertionStatus(String,boolean)*
658 public synchronized void setPackageAssertionStatus(
659 java.lang.String packageName,
662 Sets the package default assertion status for the named package. The package
663 default assertion status determines the assertion status for classes
664 initialized in the future that belong to the named package or any of its
667 A subpackage of a package named p is any package whose name begins with "p.".
668 For example, javax.swing.text is a subpackage of javax.swing, and both
669 java.util and java.lang.reflect are subpackages of java.
671 In the event that multiple package defaults apply to a given class, the package
672 default pertaining to the most specific package takes precedence over the
673 others. For example, if javax.lang and javax.lang.reflect both have package
674 defaults associated with them, the latter package default applies to classes in
677 Package defaults take precedence over the class loader's default assertion
678 status, and may be overridden on a per-class basis by invoking
679 (|java.lang.ClassLoader|) .
681 packageName - The name of the package whose package default assertion status is to be set. A
682 null value indicates the unnamed package that is "current" (Java
683 Language Specification, section 7.4.2).
684 enabled - true if classes loaded by this classloader and belonging to the named package
685 or any of its subpackages will have assertions enabled by default, false
686 if they will have assertions disabled by default.
688 *java.lang.ClassLoader.setSigners(Class,Object[])*
690 protected final void setSigners(
692 java.lang.Object[] signers)
694 Sets the signers of a class. This should be invoked after defining a class.
697 signers - The signers for the class