http://docs.spring.io/spring-amqp/docs/1.3.6.RELEASE/reference/html/sample-apps.html#d4e1285

http://docs.spring.io/spring-amqp/reference/html/index.html

http://docs.spring.io/spring-amqp/docs/1.4.0.M1/api/

原文:http://docs.oracle.com/javase/tutorial/ext/basics/load.html

The extension framework makes use of the class-loading delegation mechanism. When the runtime environment needs to load a new class for an application, it looks for the class in the following locations, in order:

  1. Bootstrap classes: the runtime classes in rt.jar, internationalization classes in i18n.jar, and others.
  2. Installed extensions: classes in JAR files in the lib/ext directory of the JRE, and in the system-wide, platform-specific extension directory (such as /usr/jdk/packages/lib/ext on the Solaris™ Operating System, but note that use of this directory applies only to Java™ 6 and later).
  3. The class path: classes, including classes in JAR files, on paths specified by the system property java.class.path. If a JAR file on the class path has a manifest with the Class-Path attribute, JAR files specified by the Class-Path attribute will be searched also. By default, the java.class.path property's value is ., the current directory. You can change the value by using the -classpath or -cp command-line options, or setting the CLASSPATH environment variable. The command-line options override the setting of the CLASSPATHenvironment variable.

The precedence list tells you, for example, that the class path is searched only if a class to be loaded hasn't been found among the classes in rt.jari18n.jar or the installed extensions.

Unless your software instantiates its own class loaders for special purposes, you don't really need to know much more than to keep this precedence list in mind. In particular, you should be aware of any class name conflicts that might be present. For example, if you list a class on the class path, you'll get unexpected results if the runtime environment instead loads another class of the same name that it found in an installed extension.

The Java Class Loading Mechanism

The Java platform uses a delegation model for loading classes. The basic idea is that every class loader has a "parent" class loader. When loading a class, a class loader first "delegates" the search for the class to its parent class loader before attempting to find the class itself.

Here are some highlights of the class-loading API:

  • Constructors in java.lang.ClassLoader and its subclasses allow you to specify a parent when you instantiate a new class loader. If you don't explicitly specify a parent, the virtual machine's system class loader will be assigned as the default parent.
  • The loadClass method in ClassLoader performs these tasks, in order, when called to load a class:
    1. If a class has already been loaded, it returns it.
    2. Otherwise, it delegates the search for the new class to the parent class loader.
    3. If the parent class loader does not find the class, loadClass calls the method findClass to find and load the class.
  • The findClass method of ClassLoader searches for the class in the current class loader if the class wasn't found by the parent class loader. You will probably want to override this method when you instantiate a class loader subclass in your application.
  • The class java.net.URLClassLoader serves as the basic class loader for extensions and other JAR files, overriding the findClass method of java.lang.ClassLoader to search one or more specified URLs for classes and resources.

To see a sample application that uses some of the API as it relates to JAR files, see the Using JAR-related APIs lesson in this tutorial.

Class Loading and the java Command

The Java platform's class-loading mechanism is reflected in the java command.

  • In the java tool, the -classpath option is a shorthand way to set the java.class.path property.
  • The -cp and -classpath options are equivalent.
  • The -jar option runs applications that are packaged in JAR files. For a description and examples of this option, see the Running JAR-Packaged Software lesson in this tutorial。

Understanding Extension Class Loading--官方的更多相关文章

  1. java classloader原理深究

    前面已经写过一篇关于java classloader的拙文java classloader原理初探. 时隔几年,再看一遍,觉得有些地方显得太过苍白,于是再来一篇: 完成一个Java类之后,经过java ...

  2. SOS.dll (SOS Debugging Extension)

    SOS.dll (SOS Debugging Extension) lays threads associated with a live thread. The -special option di ...

  3. App Extensions篇之Share Extension

    转载请注明出处:http://www.cnblogs.com/zhanggui/p/7119572.html 1.前言 这里主要是对App Extension的一些介绍以及详细给大家介绍一下Share ...

  4. gnome/KDE安装,gnome出现问题,重新安装nvdia驱动, Linux(CentOS7) NVIDIA GeForece GTX 745 显卡驱动

    新安装显示gtx745驱动NVIDIA-Linux-x86_64-346.59.run, yum groupremove kde-desktop yum groupinstall "Desk ...

  5. Magneto插件整理

    以connect20.magentocommerce.com开头的是connect 2.0的key.有些网页打不开了.但是connect的地址经测试是可用的. Mangento 免费团购模块 http ...

  6. gnome/KDE安装,gnome出现问题,重新安装nvdia驱动

    重新安装显示gtx745驱动NVIDIA-Linux-x86_64-346.59.run, yum groupremove kde-desktop yum groupinstall "Des ...

  7. 理解Java类加载机制(译文)

    理解java类加载机制 你想写类加载器?或者你遇到了ClassCastException异常,或者你遇到了奇怪的LinkageError状态约束异常.应该仔细看看java类的加载处理了. 什么是类加载 ...

  8. 加载SpriteBuilder中的scene为何不能带后缀

    我们在Xcode中切换SpriteBuilder中的scene时,一般使用的是如下代码: -(void)exitButtonPressed:(CCControl*)sender{ CCLOG(@&qu ...

  9. WinDbg 之 SOS扩展命令

    SOS.dll (SOS debugging extension) The SOS Debugging Extension (SOS.dll) helps you debug managed prog ...

随机推荐

  1. Python 的“+”和append在添加字符串时候的区别

    对于一个空的Python列表,往后添加内容有很多种,其中两种一个是用“+”直接添加内容,另外一种是Listname.append(x)来添加内容 其中,如果处理字符串 在使用“+”的时候,会将字符串拆 ...

  2. Linux服务器集群技术的概述

    目前,越来越多的网站采用Linux操作系统,提供邮件.Web.文件存储.数据库等服务.也有非常多的公司在企业内部网中利用Linux服务器提供这些服务.随着人们对Linux服务器依赖的加深,对其可靠性. ...

  3. Json数据时间格式的处理

    方法: using Newtonsoft.Json; using Newtonsoft.Json.Converters;//需引入Newtonsoft.Json.dll public class Co ...

  4. Javascript系列之js简介

    JavaScript是一种网络客户端脚本语言,javascript有三个组成部分: 1)核心(ECMAScript)---描述了语言的基本语法和对象 2)文档对象模型(DOM)---描述了处理网页内容 ...

  5. Node.js事件发射器

    在Node很多对象发出事件,例如net.Server每个同级连接到它,一个fs.readStream发出打开文件事件时,每次都发出一个事件. 它发出事件的所有对象都是events.EventEmitt ...

  6. 【Java】怎么回答java垃圾回收机制

    (1) GC是垃圾收集的意思(Gabage Collection),内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象 ...

  7. MySql的卸载问题

    windows下mysql的卸载: 彻底卸载Mysql的方法:   (1),先在服务(开始——>控制面板——>管理工具——>服务)里停掉MySQL的服务.打开控制面板-添加删除程序, ...

  8. Java中的属性与字段的区别

    Java中属性和字段的区别  Java中的属性,通常可以理解为其属名性时根据get和set方法名得出的. 其规则是:去掉get或set后其剩余的字符串,如果第二个字母是小写的,则把第一个字母也变成小写 ...

  9. 【HDOJ】2217 Visit

    挺好的一道DP. /* 2217 */ #include <iostream> #include <cstdio> #include <cstring> #incl ...

  10. java学习面向对象值static

    讲完了this这个关键字,我们继续前进,这节我们讲另外一个比较重要的东东,java当中的static,在main函数前面这个家伙都在那里一直挺着,你瞅见了么,你就不好奇么,你就不想知道他杵在那里做什么 ...