java endorsed

关于endorsed:可以的简单理解为-Djava.endorsed.dirs指定的目录面放置的jar文件,将有覆盖系统API的功能。可以牵强的理解为,将自己修改后的API打入到虚拟机指定的启动API中,取而代之。但是能够覆盖的类是有限制的,其中不包括java.lang包中的类

 

注意:

1>endorsed目录:.[jdk安装目录]./jre/lib/endorsed,不是jdk/lib/endorsed,目录中放的是Jar包,不是.java.class文件,哪怕只重写了一个类也要打包成jar包。

2>可以在dos模式查看修改后的效果(javacjava),在eclipse需要将运行选项中的JRE栏设置为jre(若设置为jdk将看不到效果)

3>重写的类必须满足jdk中的规范,例如:自定义的ArrayList类也必须实现List等接口。

 

官方说明:

Specifying the -Djava.endorsed.dirs=lib/endorsed system propertyon the Java command line will force the JVM to prefer any library it finds inthe endorsed directory over its own system libraries. Copying the jars into$JAVA_HOME/jre/lib/endorsed will do the same thing.

System.out.println(System.getProperty("java.endorsed.dirs"));

 详情请参见:http://docs.oracle.com/javase/6/docs/technotes/guides/standards/index.html

 

Java Endorsed Standards Override Mechanism

Introduction

From time to time it is necessary to update the Java platform inorder to incorporate newer versions of standards that are created outside ofthe Java Community Process (EndorsedStandards), or in order toupdate the version of a technology included in the platform to correspond to alater standalone version of that technology (Standalone Technologies).

The Endorsed StandardsOverride Mechanism provides ameans whereby later versions of classes and interfaces that implement EndorsedStandards or Standalone Technologies may be incorporated into the Java Platform.

Deploying updated packages

Packages to be updated through this mechanism should be placed inJAR files. The system property java.endorsed.dirs specifiesone or more directories that the Java runtime environment will search for suchJAR files. If more than one directory path is specified by java.endorsed.dirs,they must be separated by File.pathSeparatorChar.If no value is set for java.endorsed.dirs,then Sun Microsystem's implementation of the Java platform looks for JAR filesin a default standard location:

<java-home>\lib\endorsed          [Microsoft Windows]
<java-home>/lib/endorsed          [Solaris or Linux]

Here <java-home> refers tothe directory where the runtime software is installed (which is the top-leveldirectory of the Java SE Runtime Environment or the jre directoryin the JDK).

The Java SE runtime environment will use classes in such JAR files to overridethe corresponding classes provided in the Java platform as it was shipped.

Endorsed Standards APIs

The Endorsed Standards for Java SE constitute all classes andinterfaces that are defined in the packages listed in this section. Classes andinterfaces defined in sub-packages of listed packages are not EndorsedStandards unless those sub-packages are themselves listed. The EndorsedStandards Override Mechanism may be used to override the Java SE platformpackages in this list, and these packages may be overridden only by versions ofthe Endorsed Standard that are newer than that provided by the Java platform asreleased by Sun. With the exception of packages listed here and thetechnologies listed in the StandaloneTechnologies section below,no other packages from the Java SE platform API specification may beoverridden.

javax.rmi.CORBA
org.omg.CORBA
org.omg.CORBA.DynAnyPackage
org.omg.CORBA.ORBPackage
org.omg.CORBA.portable
org.omg.CORBA.TypeCodePackage
org.omg.CORBA_2_3
org.omg.CORBA_2_3.portable
org.omg.CosNaming
org.omg.CosNaming.NamingContextExtPackage
org.omg.CosNaming.NamingContextPackage
org.omg.Dynamic
org.omg.DynamicAny
org.omg.DynamicAny.DynAnyFactoryPackage
org.omg.DynamicAny.DynAnyPackage
org.omg.IOP
org.omg.IOP.CodecFactoryPackage
org.omg.IOP.CodecPackage
org.omg.Messaging
org.omg.PortableInterceptor
org.omg.PortableInterceptor.ORBInitInfoPackage
org.omg.PortableServer
org.omg.PortableServer.CurrentPackage
org.omg.PortableServer.POAManagerPackage
org.omg.PortableServer.POAPackage
org.omg.PortableServer.portable
org.omg.PortableServer.ServantLocatorPackage
org.omg.SendingContext
org.omg.stub.java.rmi
org.w3c.dom
org.xml.sax
org.xml.sax.ext
org.xml.sax.helpers

In addition to the packages listed above, which are part of theJava SE specification, users of Sun's Java SE Reference Implementation areallowed to use the Endorsed Standards Override Mechanism to overrideimplementation-specific classes associated with these packages, such as the org.w3c.dom sub-packagesdelivered in Sun's Reference Implementation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值