This content has been marked as final. Show 8 replies
I have a file I need to save properties... Where is aIn your JAR.
good place to save this so that if I deploy the app
my program still knows where it is?
Current discussion: http://forum.java.sun.com/thread.jspa?threadID=767316
I am using weblogic and have a jar for each project with paths for the packages. I am trying to ask how do I find the file when I do
properties.load(new FileInputStream("file name here"));
What will the file name be?
I linked a thread with an example, I think.
properties.load(new FileInputStream("file name here"));Don't think of properties in terms of files. Your properties are resouces.
Resource input streams can be obtained using the
Class.gefResourceAsStream() method. Setting your classpath
right (either in your IDE, your .jar or whatever) takes care that your resource
can be found even if your resources happen to be files.
I can't just use Class.getResourceAsStream because it isn't a static method. How can I use that method? I have no idea what I'm suppose to do on how to get that called.
I can't just use Class.getResourceAsStream because it
isn't a static method. How can I use that method? I
have no idea what I'm suppose to do on how to get
which also makes me feel that you have been ignoring the link posted. It has posted the way getResourceAsStream() is used though it refers to getResource(), the usage remains the same.
Why do that, when inside any method one already has a simple way to get at a Class object?
From a static method:
From a non-static method: