MyClass.class.getResource(“MyClass.class”).getPath() returns different paths in JBoss 4.2.3 and JBoss 5.1.0?

The short answer is that it's not safe to do what you want, since it's not guaranteed that a the jar file you're trying to locate even exists. What if the jar has been expanded? What if the app server uses some other form of storage (i.e.In a database)?

The location of the jar is an implementation detail that should not be important to the application.

The short answer is that it's not safe to do what you want, since it's not guaranteed that a the jar file you're trying to locate even exists. What if the jar has been expanded? What if the app server uses some other form of storage (i.e.In a database)?

The location of the jar is an implementation detail that should not be important to the application. That said, if you MUST do this (indicative of bad design), you'll have to try it on each target platform and write platform-specific code, which you'll have to revisit each time you upgrade to the latest version.

Thanks very much Mr Jim. I understand this and unfortunately, this is a piece of legacy code I have inherited and trying not to change too much. Obviously now, this is something need to be re-written to a standard way.

– Sethu Jun 13 at 15:27.

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