-5

In my web application, I have kept system.properties file in the web-inf/classes folder.

To Access that file's inputstream, I am using the code snippet below:

InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(SYSTEM_PROPERTIES_FILE)

Is there any other way to access that file?

Sunny Gupta
  • 6,929
  • 15
  • 52
  • 80
  • 2
    Read the javadoc for each of those method calls. – skaffman Feb 02 '12 at 11:25
  • @Skaffman Reading javadoc only gives is information about one by one method, I want the whole information of this line... – Sunny Gupta Feb 02 '12 at 11:51
  • Please explain what you are trying to achieve. Since you have a concise working method, why do you want another method? You could hard-code the location of the file, for example, but that's not a _good_ method. – DNA Feb 02 '12 at 13:33

1 Answers1

2

It simply means: Return the property file as InputStream from the ClassLoader the current thread of my application is running from (in loose english).

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
  • Is there any other way to access that file?? – Sunny Gupta Feb 02 '12 at 11:53
  • @SAM, what do you mean? Where is the file stored? Be descriptive first, and give me info needed in order for me to give you accurate answer. – Buhake Sindi Feb 02 '12 at 11:56
  • I have got the link on stackoverflow itself: http://stackoverflow.com/questions/676250/different-ways-of-loading-a-file-as-an-inputstream – Sunny Gupta Feb 02 '12 at 11:59
  • @SAM, then I can't really answer your question, since the answer has already been answered already (read the upvoted post on your link). – Buhake Sindi Feb 02 '12 at 12:15