Understanding Extension Class Loading
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:
Bootstrap classes: the runtime classes in rt.jar, internationalization classes in i18n.jar, and others.
Installed exten...
JAVA类动态载入的实现
1 前言
前段时间因为项目的需要,我搞了一套类似Servlet重新载入的一个框架,实现了类的动态载入过程。本文写了一些我的学习成果以及心得供大家分享一下。
2 类载入的原理
(下面引用网上的一篇文章):
当JVM(Java虚拟机)启动时,会形成由三个类加载器组成的初始类加载器层次结构:
bootstrap classloader | extension classloader | ...
Modify Classpath At Runtime
I've seen a lot of forum posts about how to modify the classpath at runtime and a lot of answers saying it can't be done. I needed to add JDBC driver JARs at runtime so I figured out the following method.
The system classloader (ClassLoader.getSystemClassLoader()) is a subclass of URLClassLoader. It can therefore be casted into a URLClassLoader and used as one.
URLClassLoade...
Get a load of that name! Subtle differences in various ways you can dynamically load a class
What is the difference between Class.forName() and ClassLoader.loadClass()?
Both methods try to dynamically locate and load a java.lang.Class object corresponding to a given class name. However, their behavior differs regarding which java.lang.ClassLoader they use for class loading and whether or not the resulting Class object is initialized.
The most...
Find a way out of the ClassLoader maze System, current, context? Which ClassLoader should you use?
Find a way out of the ClassLoader maze
System, current, context? Which ClassLoader should you use?
When should I use
Thread.getContextClassLoader()?
Although not frequently asked, this question is rather tough to correctly answer. It usually comes up during framework programming, when a good deal of dynamic class and resource loading goes on. In general, when loading a reso...
ClassLoader读取相应资源
java使用相对路径读取xml文件:一、xml文件一般的存放位置有三个:1.放在WEB-INF下;2.xml文件放在/WEB-INF/classes目录下或classpath的jar包中;3.放在与解析它的java类同一个包中,不一定是classpath;
二、相对应的两种使用相对路径的读取方法:
方法一:(未验证)将xml文件放在WEB-INF目录下,然后程序代码:InputStream is=getServletContext().getResourceAsStream( "/WEB-INF/xmlfile.xml" );
方法...
Plugin和App的统一路径接口
在Eclipse插件(Plugin)开发中,需要写一些Test Case(by JUnit),这些Test Case不是以插件方法运行的,而是一些普通的Application。这时要注意到插件和App获取路径的方式是不同的,这时如果你要测试一些项目中的 一些涉及到读文件的一些类,无疑会导致出错,因为在Plugin中可能由Plugin和APP组成,比如JUnit,这时在不同地方调用读文件会出错。为了让Plugin和App路径获取透明化,不防写一个工具类来提供...
最简单的Eclipse Console可用来显示信息
在Eclipse插件开发中经常会遇到需要在一个区域显示程序运行过程中的一些信息,如日志报告、错误提示等,Eclipse自身的 MessageConsole其实就可以很方便地完成这些功能,并且开发起来十分方便。当然MessageConsole的开发也有许多种方法,在这里我 只想向大家介绍一个最简单的方法,只需不到6行代码即可完成。
1、必须先引入org.eclipse.ui.console的jar包(即在plugin.xml编辑界面的Dependencies标签页的“Re...
Eclipse插件开发中对于Jar包和类文件引用的处理(彻底解决插件开发中的NoClassDefFoundError问题)
目的:Eclipse插件开发中,经常要引用第三方包或者是引用其他插件中的类,由于插件开发环境引用类路径的设置和运行平台引用类路径的设置不同,经常导致开发过程OK,一旦运行则出现NoClassDefFoundError的问题。本文的目的是全面分析各种情况下类路径的设置,以避免这个问题的出现。
说明:Jar包和类路径实际上是一个概念,比如类com.bbebfe.Test.class打包为test.jar包,添加类引用就直接添加test.jar包...
JFace依赖包
需要把以下的jar包包含到buid path里面来,才能顺利的运行JFace的程序。eclipse的版本是3.2以上
\eclipse\plugins\org.eclipse.text_3.4.0.v20080605-1800.jar
\eclipse\plugins\org.eclipse.jface.text_3.4.1.r341_v20080827-1100.jar
\eclipse\plugins\org.eclipse.jface_3.4.1.M20080827-2000.jar
\eclipse\plugins\org.eclipse.swt_3.4.1.v3449c.jar
\eclipse\plugins\org.eclipse.core.commands_3.4.0...