Forums Register Login

Classloader refactoring

+Pie Number of slices to send: Send
I have something that is already working but wanted to refactor it to work the right way. I have properties file which is setup in the JVM path of websphere (I understand that this is wrong) and then picked up in the code as follows.


I wanted to prevent picking it up from the JVM and just access it from within the ear context (URLLoader Info)

I can't use the following since it is a static method. Devx tips

Any ideas on how I can refactor this.


+Pie Number of slices to send: Send
If the object is an instance of class X, then this.getClass() == X.class. You will have to hard-code the class though; no polymorphism is possible (actually, it never is in a static context).
+Pie Number of slices to send: Send
Thanks, I tried that out but it doesn't pick up the file

+Pie Number of slices to send: Send
What's the resource name? Are you aware that the resource name must be absolute (e.g. java/lang/resource.txt) without a leading /?
+Pie Number of slices to send: Send
In the existing code it works well with

where the file resides in
/ProjectWeb/WebContent/properties/SQLDefinitions.properties

Do you think I need to change this to

today's feeble attempt to support the empire
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1162 times.
Similar Threads
open excel file
Iterating all classes in package - of different Java project
URL->filename conversion problem
simple search v/s classpath search
java.io.FileNotFoundException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:44:36.