this.getclass().getresource("/").getpath().substring(1)获得路径为e:/myeclipse/test/webroot/web-inf/classes/,即主目录。
this.getclass().getresource("").getpath().substring(1)获得路径为e:/myeclipse/test/webroot/web-inf/classes/net/hncu/db/,即本文件的相对路径。
this.getclass().getresource(".").getpath().substring(1)和this.getclass().getresource("").getpath().substring(1)效果一样
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!
网友评论