<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2-rc) on Fri Jun 13 00:14:25 PDT 2003 -->
<TITLE>
URLClassLoader (Java 2 Platform SE v1.4.2)
</TITLE>
<META NAME="keywords" CONTENT="java.net.URLClassLoader class">
<META NAME="keywords" CONTENT="addURL()">
<META NAME="keywords" CONTENT="getURLs()">
<META NAME="keywords" CONTENT="findClass()">
<META NAME="keywords" CONTENT="definePackage()">
<META NAME="keywords" CONTENT="findResource()">
<META NAME="keywords" CONTENT="findResources()">
<META NAME="keywords" CONTENT="getPermissions()">
<META NAME="keywords" CONTENT="newInstance()">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="URLClassLoader (Java 2 Platform SE v1.4.2)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" >
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/URLClassLoader.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/net/URL.html" title="class in java.net"><B>PREV CLASS</B></A>
<A HREF="../../java/net/URLConnection.html" title="class in java.net"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="URLClassLoader.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
java.net</FONT>
<BR>
Class URLClassLoader</H2>
<PRE>
<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
<IMG SRC="http://www.163design.net/resources/inherit.gif" ALT="extended by"><A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">java.lang.ClassLoader</A>
<IMG SRC="http://www.163design.net/resources/inherit.gif" ALT="extended by"><A HREF="../../java/security/SecureClassLoader.html" title="class in java.security">java.security.SecureClassLoader</A>
<IMG SRC="http://www.163design.net/resources/inherit.gif" ALT="extended by"><B>java.net.URLClassLoader</B>
</PRE>
<HR>
<DL>
<DT>public class <B>URLClassLoader</B><DT>extends <A HREF="../../java/security/SecureClassLoader.html" title="class in java.security">SecureClassLoader</A></DL>
<P>
This class loader is used to load classes and resources from a search
path of URLs referring to both JAR files and directories. Any URL that
ends with a '/' is assumed to refer to a directory. Otherwise, the URL
is assumed to refer to a JAR file which will be opened as needed.
这个类加载器用于从指向JAR文件和目录的URL搜索路径中加载类和资源。任何以“/”结束的URL被认为是指向目录的,
否则,URL被认为指向需要打开的JAR文件。
<p>
The AccessControlContext of the thread that created the instance of
URLClassLoader will be used when subsequently loading classes and
resources.
当加载类和资源时,使用创建URLClassLoader实例的线程的AccessControlContext。
<p>
The classes that are loaded are by default granted permission only to
access the URLs specified when the URLClassLoader was created.
被加载的类在默认情况下,是被授权只能访问在创建URLClassLoader类时指定的URL。
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[])">URLClassLoader</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls)</CODE>
<BR>
Constructs a new URLClassLoader for the specified URLs using the
default delegation parent <code>ClassLoader</code>.
使用默认的代理父ClassLoader构造一个指定URL的新的URLClassLoader。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[], java.lang.ClassLoader)">URLClassLoader</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent)</CODE>
<BR>
Constructs a new URLClassLoader for the given URLs.
构造一个指定URL的新的URLClassLoader。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[], java.lang.ClassLoader, java.net.URLStreamHandlerFactory)">URLClassLoader</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent,
<A HREF="../../java/net/URLStreamHandlerFactory.html" title="interface in java.net">URLStreamHandlerFactory</A> factory)</CODE>
<BR>
Constructs a new URLClassLoader for the specified URLs, parent
class loader, and URLStreamHandlerFactory.
构造一个指定URL、父类加载器和URLStreamHandlerFactory的新的URLClassLoader。</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#addURL(java.net.URL)">addURL</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A> url)</CODE>
<BR>
Appends the specified URL to the list of URLs to search for
classes and resources.
在用于搜索类和资源的URL列表中添加指定的URL。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../java/lang/Package.html" title="class in java.lang">Package</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#definePackage(java.lang.String, java.util.jar.Manifest, java.net.URL)">definePackage</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name,
<A HREF="../../java/util/jar/Manifest.html" title="class in java.util.jar">Manifest</A> man,
<A HREF="../../java/net/URL.html" title="class in java.net">URL</A> url)</CODE>
<BR>
Defines a new package by name in this ClassLoader.
在此类加载器中用名称定义新的包。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../java/lang/Class.html" title="class in java.lang">Class</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#findClass(java.lang.String)">findClass</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)</CODE>
<BR>
Finds and loads the class with the specified name from the URL search
path.
从URL搜索路径查找并加载指定名称的类。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/net/URL.html" title="class in java.net">URL</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#findResource(java.lang.String)">findResource</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)</CODE>
<BR>
Finds the resource with the specified name on the URL search path.
从URL搜索路径查找并加载指定名称的资源。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/util/Enumeration.html" title="interface in java.util">Enumeration</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#findResources(java.lang.String)">findResources</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)</CODE>
<BR>
Returns an Enumeration of URLs representing all of the resources
on the URL search path having the specified name.
返回含指定名称的URL搜索路径的所有资源的URL表示的枚举。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../java/security/PermissionCollection.html" title="class in java.security">PermissionCollection</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#getPermissions(java.security.CodeSource)">getPermissions</A></B>(<A HREF="../../java/security/CodeSource.html" title="class in java.security">CodeSource</A> codesource)</CODE>
<BR>
Returns the permissions for the given codesource object.
返回给定代码资源对象的许可。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#getURLs()">getURLs</A></B>()</CODE>
<BR>
Returns the search path of URLs for loading classes and resources.
返回用于加载类和资源的URL搜索路径。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../java/net/URLClassLoader.html" title="class in java.net">URLClassLoader</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#newInstance(java.net.URL[])">newInstance</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls)</CODE>
<BR>
Creates a new instance of URLClassLoader for the specified
URLs and default parent class loader.
创建一个使用指定URL和默认父类加载器的URLClassLoader实例。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../java/net/URLClassLoader.html" title="class in java.net">URLClassLoader</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/net/URLClassLoader.html#newInstance(java.net.URL[], java.lang.ClassLoader)">newInstance</A></B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent)</CODE>
<BR>
Creates a new instance of URLClassLoader for the specified
URLs and parent class loader.
创建一个使用指定URL和父类加载器的URLClassLoader实例。</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.security.SecureClassLoader"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.security.<A HREF="../../java/security/SecureClassLoader.html" title="class in java.security">SecureClassLoader</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/security/SecureClassLoader.html#defineClass(java.lang.String, byte[], int, int, java.security.CodeSource)">defineClass</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.ClassLoader"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/ClassLoader.html#clearAssertionStatus()">clearAssertionStatus</A>, <A HREF="../../java/lang/ClassLoader.html#defineClass(byte[], int, int)">defineClass</A>, <A HREF="../../java/lang/ClassLoader.html#defineClass(java.lang.String, byte[], int, int)">defineClass</A>, <A HREF="../../java/lang/ClassLoader.html#defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain)">defineClass</A>, <A HREF="../../java/lang/ClassLoader.html#definePackage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.net.URL)">definePackage</A>, <A HREF="../../java/lang/ClassLoader.html#findLibrary(java.lang.String)">findLibrary</A>, <A HREF="../../java/lang/ClassLoader.html#findLoadedClass(java.lang.String)">findLoadedClass</A>, <A HREF="../../java/lang/ClassLoader.html#findSystemClass(java.lang.String)">findSystemClass</A>, <A HREF="../../java/lang/ClassLoader.html#getPackage(java.lang.String)">getPackage</A>, <A HREF="../../java/lang/ClassLoader.html#getPackages()">getPackages</A>, <A HREF="../../java/lang/ClassLoader.html#getParent()">getParent</A>, <A HREF="../../java/lang/ClassLoader.html#getResource(java.lang.String)">getResource</A>, <A HREF="../../java/lang/ClassLoader.html#getResourceAsStream(java.lang.String)">getResourceAsStream</A>, <A HREF="../../java/lang/ClassLoader.html#getResources(java.lang.String)">getResources</A>, <A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()">getSystemClassLoader</A>, <A HREF="../../java/lang/ClassLoader.html#getSystemResource(java.lang.String)">getSystemResource</A>, <A HREF="../../java/lang/ClassLoader.html#getSystemResourceAsStream(java.lang.String)">getSystemResourceAsStream</A>, <A HREF="../../java/lang/ClassLoader.html#getSystemResources(java.lang.String)">getSystemResources</A>, <A HREF="../../java/lang/ClassLoader.html#loadClass(java.lang.String)">loadClass</A>, <A HREF="../../java/lang/ClassLoader.html#loadClass(java.lang.String, boolean)">loadClass</A>, <A HREF="../../java/lang/ClassLoader.html#resolveClass(java.lang.Class)">resolveClass</A>, <A HREF="../../java/lang/ClassLoader.html#setClassAssertionStatus(java.lang.String, boolean)">setClassAssertionStatus</A>, <A HREF="../../java/lang/ClassLoader.html#setDefaultAssertionStatus(boolean)">setDefaultAssertionStatus</A>, <A HREF="../../java/lang/ClassLoader.html#setPackageAssertionStatus(java.lang.String, boolean)">setPackageAssertionStatus</A>, <A HREF="../../java/lang/ClassLoader.html#setSigners(java.lang.Class, java.lang.Object[])">setSigners</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="URLClassLoader(java.net.URL[], java.lang.ClassLoader)"><!-- --></A><H3>
URLClassLoader</H3>
<PRE>
public <B>URLClassLoader</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent)</PRE>
<DL>
<DD>Constructs a new URLClassLoader for the given URLs. The URLs will be
searched in the order specified for classes and resources after first
searching in the specified parent class loader. Any URL that ends with
a '/' is assumed to refer to a directory. Otherwise, the URL is assumed
to refer to a JAR file which will be downloaded and opened as needed.
构造一个指定URL的新的URLClassLoader。首先在父类加载器搜索后,以指定的类和资源的顺序搜索URL。
任何以“/”结束的URL被认为是指向目录的, 否则,URL被认为指向被下载且需要打开的JAR文件。
<p>If there is a security manager, this method first
calls the security manager's <code>checkCreateClassLoader</code> method
to ensure creation of a class loader is allowed.
如果存在安全管理器,该方法首先调用安全管理器的checkCreateClassLoader方法以确认创建类加载器被允许。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE> - the URLs from which to load classes and resources
从其处加载类和资源的URL<DD><CODE>parent</CODE> - the parent class loader for delegation
代理的父类加载器
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/SecurityException.html" title="class in java.lang">SecurityException</A></CODE> - if a security manager exists and its
<code>checkCreateClassLoader</code> method doesn't allow
creation of a class loader.
如果安全管理存在,它的checkCreateClassLoader方法不允许创建类加载器时抛出<DT><B>See Also:</B><DD><A HREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<HR>
<A NAME="URLClassLoader(java.net.URL[])"><!-- --></A><H3>
URLClassLoader</H3>
<PRE>
public <B>URLClassLoader</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls)</PRE>
<DL>
<DD>Constructs a new URLClassLoader for the specified URLs using the
default delegation parent <code>ClassLoader</code>. The URLs will
be searched in the order specified for classes and resources after
first searching in the parent class loader. Any URL that ends with
a '/' is assumed to refer to a directory. Otherwise, the URL is
assumed to refer to a JAR file which will be downloaded and opened
as needed.
使用默认的代理父ClassLoader构造一个指定URL的新的URLClassLoader。首先在父类加载器搜索后,以指定的类和资源的顺序搜索URL。
任何以“/”结束的URL被认为是指向目录的, 否则,URL被认为指向被下载且需要打开的JAR文件。
<p>If there is a security manager, this method first
calls the security manager's <code>checkCreateClassLoader</code> method
to ensure creation of a class loader is allowed.
如果存在安全管理器,该方法首先调用安全管理器的checkCreateClassLoader方法以确认创建类加载器被允许。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE> - the URLs from which to load classes and resources
从其处加载类和资源的URL
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/SecurityException.html" title="class in java.lang">SecurityException</A></CODE> - if a security manager exists and its
<code>checkCreateClassLoader</code> method doesn't allow
creation of a class loader.
如果安全管理存在,它的checkCreateClassLoader方法不允许创建类加载器时抛出<DT><B>See Also:</B><DD><A HREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<HR>
<A NAME="URLClassLoader(java.net.URL[], java.lang.ClassLoader, java.net.URLStreamHandlerFactory)"><!-- --></A><H3>
URLClassLoader</H3>
<PRE>
public <B>URLClassLoader</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent,
<A HREF="../../java/net/URLStreamHandlerFactory.html" title="interface in java.net">URLStreamHandlerFactory</A> factory)</PRE>
<DL>
<DD>Constructs a new URLClassLoader for the specified URLs, parent
class loader, and URLStreamHandlerFactory. The parent argument
will be used as the parent class loader for delegation. The
factory argument will be used as the stream handler factory to
obtain protocol handlers when creating new URLs.
构造一个指定URL、父类加载器和URLStreamHandlerFactory的新的URLClassLoader。
parent参数用作代理的父类加载器。factory参数用作当创建新的URL时获得协议句柄的流句柄工厂。
<p>If there is a security manager, this method first
calls the security manager's <code>checkCreateClassLoader</code> method
to ensure creation of a class loader is allowed.
如果存在安全管理器,该方法首先调用安全管理器的checkCreateClassLoader方法以确认创建类加载器被允许。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE> - the URLs from which to load classes and resources
从其处加载类和资源的URL<DD><CODE>parent</CODE> - the parent class loader for delegation
代理的父类加载器<DD><CODE>factory</CODE> - the URLStreamHandlerFactory to use when creating URLs
在创建URL时使用的URLStreamHandlerFactory
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/SecurityException.html" title="class in java.lang">SecurityException</A></CODE> - if a security manager exists and its
<code>checkCreateClassLoader</code> method doesn't allow
creation of a class loader.
如果安全管理存在,它的checkCreateClassLoader方法不允许创建类加载器时抛出<DT><B>See Also:</B><DD><A HREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="addURL(java.net.URL)"><!-- --></A><H3>
addURL</H3>
<PRE>
protected void <B>addURL</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A> url)</PRE>
<DL>
<DD>Appends the specified URL to the list of URLs to search for
classes and resources.
在用于搜索类和资源的URL列表中添加指定的URL。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to be added to the search path of URLs 在URL搜索路径中添加的URL</DL>
</DD>
</DL>
<HR>
<A NAME="getURLs()"><!-- --></A><H3>
getURLs</H3>
<PRE>
public <A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] <B>getURLs</B>()</PRE>
<DL>
<DD>Returns the search path of URLs for loading classes and resources.
This includes the original list of URLs specified to the constructor,
along with any URLs subsequently appended by the addURL() method.
返回用于加载类和资源的URL搜索路径。包括指定给构造函数的原始URL列表,及使用addURL()方法后添加的URL。
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the search path of URLs for loading classes and resources. 用于加载类和资源的URL搜索路径。</DL>
</DD>
</DL>
<HR>
<A NAME="findClass(java.lang.String)"><!-- --></A><H3>
findClass</H3>
<PRE>
protected <A HREF="../../java/lang/Class.html" title="class in java.lang">Class</A> <B>findClass</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)
throws <A HREF="../../java/lang/ClassNotFoundException.html" title="class in java.lang">ClassNotFoundException</A></PRE>
<DL>
<DD>Finds and loads the class with the specified name from the URL search
path. Any URLs referring to JAR files are loaded and opened as needed
until the class is found.
从URL搜索路径查找并加载指定名称的类。加载指向JAR文件的URL并在需要时打开直到找到类。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/ClassLoader.html#findClass(java.lang.String)">findClass</A></CODE> in class <CODE><A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the class 类名
<DT><B>Returns:</B><DD>the resulting class 结果类
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/ClassNotFoundException.html" title="class in java.lang">ClassNotFoundException</A></CODE> - if the class could not be found 如果找不到该类抛出</DL>
</DD>
</DL>
<HR>
<A NAME="definePackage(java.lang.String, java.util.jar.Manifest, java.net.URL)"><!-- --></A><H3>
definePackage</H3>
<PRE>
protected <A HREF="../../java/lang/Package.html" title="class in java.lang">Package</A> <B>definePackage</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name,
<A HREF="../../java/util/jar/Manifest.html" title="class in java.util.jar">Manifest</A> man,
<A HREF="../../java/net/URL.html" title="class in java.net">URL</A> url)
throws <A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></PRE>
<DL>
<DD>Defines a new package by name in this ClassLoader. The attributes
contained in the specified Manifest will be used to obtain package
version and sealing information. For sealed packages, the additional
URL specifies the code source URL from which the package was loaded.
在此类加载器中用名称定义新的包。包含在指定的Manifest中的属性用于获得包版本和封装信息。
对于已封装包,附加URL指定来自加载的包的代码源URL。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the package name
包名<DD><CODE>man</CODE> - the Manifest containing package version and sealing
information
包含包版本和封装信息的Manifest<DD><CODE>url</CODE> - the code source url for the package, or null if none
用于包的代码源url,如果没有则为null
<DT><B>Returns:</B><DD>the newly defined Package object 新定义的包对象
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the package name duplicates
an existing package either in this class loader or one
of its ancestors
如果包同现有包相同,或在此类加器或其父辈之一时抛出</DL>
</DD>
</DL>
<HR>
<A NAME="findResource(java.lang.String)"><!-- --></A><H3>
findResource</H3>
<PRE>
public <A HREF="../../java/net/URL.html" title="class in java.net">URL</A> <B>findResource</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)</PRE>
<DL>
<DD>Finds the resource with the specified name on the URL search path.
从URL搜索路径查找并加载指定名称的资源。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/ClassLoader.html#findResource(java.lang.String)">findResource</A></CODE> in class <CODE><A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the resource 资源名
<DT><B>Returns:</B><DD>a <code>URL</code> for the resource, or <code>null</code>
if the resource could not be found. 资源的URL,如果找不到该资源,返回null</DL>
</DD>
</DL>
<HR>
<A NAME="findResources(java.lang.String)"><!-- --></A><H3>
findResources</H3>
<PRE>
public <A HREF="../../java/util/Enumeration.html" title="interface in java.util">Enumeration</A> <B>findResources</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> name)
throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Returns an Enumeration of URLs representing all of the resources
on the URL search path having the specified name.
返回含指定名称的URL搜索路径的所有资源的URL表示的枚举。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/ClassLoader.html#findResources(java.lang.String)">findResources</A></CODE> in class <CODE><A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the resource name 资源名
<DT><B>Returns:</B><DD>an <code>Enumeration</code> of <code>URL</code>s URL的枚举
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O exception occurs 如果发生I/O异常抛出</DL>
</DD>
</DL>
<HR>
<A NAME="getPermissions(java.security.CodeSource)"><!-- --></A><H3>
getPermissions</H3>
<PRE>
protected <A HREF="../../java/security/PermissionCollection.html" title="class in java.security">PermissionCollection</A> <B>getPermissions</B>(<A HREF="../../java/security/CodeSource.html" title="class in java.security">CodeSource</A> codesource)</PRE>
<DL>
<DD>Returns the permissions for the given codesource object.
The implementation of this method first calls super.getPermissions
and then adds permissions based on the URL of the codesource.
返回给定代码资源对象的许可。此方法的实现首先调用super.getPermissions,然后
增加基于代码源URL的许可。
<p>
If the protocol is "file"
and the path specifies a file, then permission to read that
file is granted. If protocol is "file" and the path is
a directory, permission is granted to read all files
and (recursively) all files and subdirectories contained in
that directory.
如果协议为“file”且路径指定为一个文件,则授予读取此文件的许可。
如果协议为“file”且路径指定为一个目录,则授予读取此目录中包括子目录中所有文件的许可。
<p>
If the protocol is not "file", then
to connect to and accept connections from the URL's host is granted.
如果协议不是“file”,则授予连接到并被URL主机接受的许可。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/security/SecureClassLoader.html#getPermissions(java.security.CodeSource)">getPermissions</A></CODE> in class <CODE><A HREF="../../java/security/SecureClassLoader.html" title="class in java.security">SecureClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codesource</CODE> - the codesource 代码源
<DT><B>Returns:</B><DD>the permissions granted to the codesource 授予代码源的许可</DL>
</DD>
</DL>
<HR>
<A NAME="newInstance(java.net.URL[], java.lang.ClassLoader)"><!-- --></A><H3>
newInstance</H3>
<PRE>
public static <A HREF="../../java/net/URLClassLoader.html" title="class in java.net">URLClassLoader</A> <B>newInstance</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls,
<A HREF="../../java/lang/ClassLoader.html" title="class in java.lang">ClassLoader</A> parent)</PRE>
<DL>
<DD>Creates a new instance of URLClassLoader for the specified
URLs and parent class loader. If a security manager is
installed, the <code>loadClass</code> method of the URLClassLoader
returned by this method will invoke the
<code>SecurityManager.checkPackageAccess</code> method before
loading the class.
创建一个使用指定URL和父类加载器的URLClassLoader实例。如果装有安全管理器,
此方法返回的URLClassLoader的loadClass方法将在加载类前调用SecurityManager.checkPackageAccess方法。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>urls</CODE> - the URLs to search for classes and resources 用于类和资源搜索的URL<DD><CODE>parent</CODE> - the parent class loader for delegation
代理的父类加载器
<DT><B>Returns:</B><DD>the resulting class loader 结果类加载器</DL>
</DD>
</DL>
<HR>
<A NAME="newInstance(java.net.URL[])"><!-- --></A><H3>
newInstance</H3>
<PRE>
public static <A HREF="../../java/net/URLClassLoader.html" title="class in java.net">URLClassLoader</A> <B>newInstance</B>(<A HREF="../../java/net/URL.html" title="class in java.net">URL</A>[] urls)</PRE>
<DL>
<DD>Creates a new instance of URLClassLoader for the specified
URLs and default parent class loader. If a security manager is
installed, the <code>loadClass</code> method of the URLClassLoader
returned by this method will invoke the
<code>SecurityManager.checkPackageAccess</code> before
loading the class.
创建一个使用指定URL和默认父类加载器的URLClassLoader实例。如果装有安全管理器,
此方法返回的URLClassLoader的loadClass方法将在加载类前调用SecurityManager.checkPackageAccess方法。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>urls</CODE> - the URLs to search for classes and resources 用于类和资源搜索的URL
<DT><B>Returns:</B><DD>the resulting class loader 结果类加载器</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/URLClassLoader.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/net/URL.html" title="class in java.net"><B>PREV CLASS</B></A>
<A HREF="../../java/net/URLConnection.html" title="class in java.net"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="URLClassLoader.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1"><a href="Submit'>http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../../../relnotes/license.html">license terms</a>. Also see the <a href="documentation'>http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>
</BODY>
</HTML>