关于tomcat5使用javaben的问题

quchch 2004-04-28 03:07:26
我在javabean里面读取一个文件,文件是一个配置文件。
File file = new File("shltDb.properties");
String s = file.getAbsolutePath().replace('\\', '/');
properties = new Properties();
FileInputStream fileinputstream = new FileInputStream(s);
properties.load(fileinputstream);
if(fileinputstream != null)
fileinputstream.close();
}catch(IOException ioexception){
System.out.println("read file failure!");
}

问题是其中的配置文件shltDb.properties放在什么地方才能读取到?
#当然指定文件的绝对地址,例如C:\tomcat5\shltDb.properties,这样可以找到文件,但我不想用绝对地址的方式。
我放在tomcat的根目录下,common/classes下都不行,请教会的人。如果解决,88分全奉上。
...全文
24 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
pwmzm 2004-04-28
  • 打赏
  • 举报
回复
对。
yaray 2004-04-28
  • 打赏
  • 举报
回复
放在与这个Bean的类文件的同一目录下即可
顽皮小熊 2004-04-28
  • 打赏
  • 举报
回复
我知道这个 做过 不知道你用了能不能行
quchch 2004-04-28
  • 打赏
  • 举报
回复
看了啊,还是不会。
feiyuwen 2004-04-28
  • 打赏
  • 举报
回复
http://www.csdn.net/develop/article/24/24146.shtm

看完你就会了

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧