Topic: 如何获取当前的路径?

  Print this page

1.如何获取当前的路径? Copy to clipboard
Posted by: newface998
Posted on: 2004-11-02 08:43

用什么方法能获取当前执行类的路径

2.Re:如何获取当前的路径? [Re: newface998] Copy to clipboard
Posted by: think
Posted on: 2004-11-02 09:58

是这个吗?

getClass().getResource("").getPath()

3.Re:如何获取当前的路径? [Re: newface998] Copy to clipboard
Posted by: Lawme
Posted on: 2004-11-02 10:08

System.getProperty("user.dir");

4.Re:如何获取当前的路径? [Re: newface998] Copy to clipboard
Posted by: newface998
Posted on: 2004-11-02 11:00

用getClass().getResource("").getPath() 可以获取到
谢谢

5.Re:如何获取当前的路径? [Re: think] Copy to clipboard
Posted by: wuyunlong
Posted on: 2004-11-03 08:34

用这个方法:getClass().getResource("").getPath();
你必须将当前类加入到类路径,否则就不行,这点在web
开发和应用程序开发中可以得到验证。

6.Re:如何获取当前的路径? [Re: Lawme] Copy to clipboard
Posted by: jameszhang
Posted on: 2004-11-03 10:34

Lawme wrote:
System.getProperty("user.dir");

应该用这个吧


   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