GetResource in java web project?

As javadoc for getResource says will first search the parent class loader for the resource; if the parent is null the path of the class loader built-in to the virtual machine is searched. That failing, this method will invoke findResource(String) to find the resource. So, you should you have the class from Main2 in your classpath.An alternative is to implement your own ClassLoader, and implement the findResource method to load classes.

Having the class in your classpath seems the more reasonable/easy approach (I personally think that messing with CLassLoaders is generally not a good idea, unless you really know what you're doing).

Thanks for the answer, what I did is adding Main2/src/main/webapp to the class path and then I m giving just /web. Xml as path from Main1 but it still throw null.. – Brake May 16 at 10:57 @Brake: are you trying to load a class or a file (like web. Xml)?

In any case web. Xml is under WEB-INF, so you should load WEB-INF/web. Xml – MarcoS May 16 at 12:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions