Topic: 请问: 如何得到tomcat安装后的路径?

  Print this page

1.请问: 如何得到tomcat安装后的路径? Copy to clipboard
Posted by: shinwell
Posted on: 2004-12-26 13:57

在tomcat下运行多个webapp, 想在每个webapp的servlet里获取tomcat
的安装路径, 不知道如何做?

在jakarta.apache.com/tomcat的邮件列表里翻了半小时, 居然没有找到
答案Sad

2.Re:请问: 如何得到tomcat安装后的路径? [Re: shinwell] Copy to clipboard
Posted by: safe
Posted on: 2004-12-26 14:29

getServletContext().getRealPath("/");

3.Re:请问: 如何得到tomcat安装后的路径? [Re: safe] Copy to clipboard
Posted by: shinwell
Posted on: 2004-12-26 21:03

>>getServletContext().getRealPath("/");

这方法不行的, 兄弟。
不过还是感谢你的回复:-p

4.Re:请问: 如何得到tomcat安装后的路径? [Re: shinwell] Copy to clipboard
Posted by: safe
Posted on: 2004-12-26 23:24

i'm sorry for my previous reply don't work
and maybe we can try
System.out.println(new File(System.getProperty("user.dir")));
System.out.println(new File(System.getProperty("catalina.home")));

I got the result like the followings
C:\jakarta-tomcat-5.0.28\bin
C:\jakarta-tomcat-5.0.28

5.Re:请问: 如何得到tomcat安装后的路径? [Re: safe] Copy to clipboard
Posted by: shinwell
Posted on: 2004-12-27 09:39

再次感谢!
我试试你的方法.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923