Software Ninja

The Software Ninja is a professional software developer. Here are some books I find interesting and useful.

My Photo
Name: Matt Smith
Location: Utah, United States

While continuing to provide for his family as a computer programmer, Matt has been studying marriage and relationships for many years. He is the author of the soon to be released book: Ferocious Flirting: Making Marriage Wonderful. He is also available for speaking to groups on keeping the romance going in marriage. Feel free to email me with comments, questions or suggestions.

Tuesday, October 16, 2007

Which class or resource is being lodaed?

I was having a problem with spring not being able to parse the applicationContext.xml. I finally checked and found out the wrong applicationContext.xml was first in the CLASSPATH.

The code to do this is easy:

System.out.println(this.getClass().getClassLoader().getResource("applicationContext.xml"));


You can also find class files. To find java.lang.Object use

System.out.println(this.getClass().getClassLoader().getResource("java/lang/Object.class"));

The result is something like:

jar:file:/C:/Program%20Files/Java/j2sdk1.4.2_14/jre/lib/rt.jar!/java/lang/Object.class

Notice how the JRE version is in the output.

0 Comments:

Post a Comment

<< Home