如下所示:
<span style="font-size: 18px"> system.out.println("++++++++++++++++++++++++"); string path = system.getproperty("java.class.path"); string path2 = freemarkerwriter.class.getprotectiondomain().getcodesource().getlocation().getpath(); string path3 = freemarkerwriter.class.getprotectiondomain().getcodesource().getlocation().getfile(); string path4 = thread.currentthread().getcontextclassloader().getresource("").getpath(); system.out.println("path 1 = " + path); system.out.println("path 2 = " + path2); system.out.println("path 3 = " + path3); system.out.println("path 4 = " + path4); system.out.println("++++++++++++++++++++++++"); </span>
以上这篇java中获取类路径classpath的简单方法(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
springmvc之ResponseBody响应json数据遇到的错误及解决
uni-app 后台升级 静默升级 uniapp 后台更新 静默更新 在线升级
SpringBoot多Module启动报错Could not transfer metadata
Hibernate项目报错:Cannot call sendError() after the response has been committed
网友评论