axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel.Kusc...@ic3s.de
Subject Antwort: Re: Help Read in Properties File
Date Wed, 14 Mar 2007 15:15:19 GMT
If you want to read in a file in your classpath (without exactly knowing 
where to find) you have to do following:

your.package.YourClass.class.getResourceAsStream("/yourconfig.cfg")

Note: The SLASH before configuration file name is important. Without it, 
java won't search for this file into your classpath.
It will then only look if this file is in the same folder, where your 
class lies:

YourClass.class.getResourceAsStream("yourconfig.cfg")
-->Config had to lie here /your/package/yourconfig.cfg

wbr,

Daniel Kuschow
Mime
View raw message