In general classpath is the path where JVM can find .class files and resources of your application and in this tutorial we will see how to load resources such as .properties files that are on classpath. Class' getResourceAsStream() One way to load a…
In Java, you can load all kinds of resources using the same API but with different URL protocols: file:///tmp.txt http://127.0.0.1:8080/a.properties jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class This nicely decouples the actual loading of th…
@(Java)[Reference] Java Reference简要概述 Reference对象封装了其它对象的引用,可以和普通的对象一样操作. Java提供了四种不同类型的引用,引用级别从高到低分别为FinalReference,SoftReference,WeakReference,PhantomReference.其中FinalReference不向外提供.每种类型对应着不同级别的可达性. 强引用FinalReference 强引用指的是,程序中有直接可达的引用,而不需要通过任何引用对象…
严重: Exception starting filter struts2 Unable to load configuration. - action - file:/E:/Java/Tomcat7.0/apache-tomcat-7.0.68-windows-x64/apache-tomcat-7.0.68/webapps/SSH2Integrate/WEB-INF/classes/struts.xml:8:43 at org.apache.struts2.dispatcher.Dispat…
@(Java)[Reference] Java Reference 源码分析 Reference对象封装了其它对象的引用,可以和普通的对象一样操作,在一定的限制条件下,支持和垃圾收集器的交互.即可以使用Reference对象来引用其它对象,但是最后还是会被垃圾收集器回收.程序有时候也需要在对象回收后被通知,以告知对象的可达性发生变更.   Java提供了四种不同类型的引用,引用级别从高到低分别为FinalReference,SoftReference,WeakReference,PhantomR…
今天在浏览网站的时候遇到如下报警信息: The SSL certificate used to load resources from https://xxx.com will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. 于是查询了…
相关讲解,参考: Java Reference 源码分析 Java Reference详解 Reference: // 名称说明下:Reference指代引用对象本身,Referent指代被引用对象 /** * Reference的抽象基类,这个类中定义了所有引用对象的常用操作. * 由于引用对象是通过与垃圾回收器密切合作来实现的,因此,不要直接继承此基类; * * @since 1.2 */ public abstract class Reference<T> { /* * 一个Refere…
Java 实例 - 如何执行指定class文件目录(classpath)  Java 实例 如果我们 Java 编译后的class文件不在当前目录,我们可以使用 -classpath 来指定class文件目录: C:> java -classpath C:\java\DemoClasses HelloWorld 以上命令中我们使用了 -classpath 参数指定了 HelloWorld 的 class 文件所在目录. 如果class文件在jar文件中,则命令如下: c:> java -cla…
Overview The java.lang.ref package provides more flexible types of references than are otherwise available, permitting limited interaction between the application and the Java Virtual Machine (JVM) garbage collector. It is an important package, centr…
本文转载自Java Reference核心原理分析 导语 带着问题,看源码针对性会更强一点.印象会更深刻.并且效果也会更好.所以我先卖个关子,提两个问题(没准下次跳槽时就被问到). 我们可以用ByteBuffer的allocateDirect方法,申请一块堆外内存创建一个DirectByteBuffer对象,然后利用它去操作堆外内存.这些申请完的堆外内存,我们可以回收吗?可以的话是通过什么样的机制回收的? 大家应该都知道WeakHashMap可以用来实现内存相对敏感的本地缓存,为什么WeakHa…