• Post Reply Bookmark Topic Watch Topic
  • New Topic

getResourceAsStream  RSS feed

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I have a text file called mytext.txt
If I put this file in a JAR (which is in the classpath) and a duplicate copy outside the jar but on the classpath which one gets loaded when I use getResourceAsStream()?
I presume the answer will be "which ever one the classloader finds first".
However, this isn't very helpful.
Is there any way to know for sure?
Thanks,
Drew
 
Jamin Williams
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this once and it always found the file that was specified first on the classpath.
This is something I found which might help. This article states that the first class found is the one that is loaded. Mastering the classpath with JWhich
Jamin
[ April 06, 2004: Message edited by: Jamin Williams ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!