码迷,mamicode.com
首页 >  
搜索关键字:getpath    ( 286个结果
java定位类加载路径
无论是maven工程还是eclipse工程,有时工程引入的jar包并不是运行是实际使用的jar,真正的jar可能是容器内部,这个这个时候如果出现依赖冲突,可以通过this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();精确获取使用运行的类,加载的位置。
分类:编程语言   时间:2015-05-04 22:19:47    阅读次数:153
java中获得当前文件路径多种方法
java中获得当前文件路径多种方法 public String getClassPath(){ String path=""; try { path=new File(getClass().getClassLoader().getResource("").toURI()).getPath(); }catch (URISyntaxException ex) {} re...
分类:编程语言   时间:2015-04-21 11:31:05    阅读次数:145
windows下有个目录名称中间有空格 java读目录空格变成%20 处理方法
String path=Parameter.class.getResource("").getPath();//得到路径//String path=Parameter.class.getResource("").toString();//这个不行,无法处理里面的空格。//System.out.pri...
分类:编程语言   时间:2015-04-08 21:27:24    阅读次数:202
JavaBean找到项目下的文件这里是\WEB-INF\classes\下面的属性文件
String baseinfo="/com/Bean/DBhelp.properties"; filename=getClass().getClassLoader().getResource("/").getPath(); filename=filename.substring(1,file...
分类:编程语言   时间:2015-04-08 21:21:50    阅读次数:196
android 调用系统图库查看指定路径的图片
//使用IntentIntent intent = new Intent(Intent.ACTION_VIEW);//Uri mUri = Uri.parse("file://" + picFile.getPath());Android3.0以后最好不要通过该方法,存在一些小Bugintent.se...
分类:移动开发   时间:2015-03-30 15:50:57    阅读次数:234
java 动态获取web应用的部署路径
public static String DEPLOY_PATH = null; static { String CurrentClassFilePath = Constant.class.getResource("").getPath(); int lastpath = CurrentClassFilePath.lastIndexOf("WEB-INF/"); DEPLOY_PA...
分类:编程语言   时间:2015-03-13 18:45:02    阅读次数:146
java读取src下面的目录
java读取src目录下的文件,有几种方法 方法一: Thread.currentThread().getContextClassLoader().getResourceAsStream(""); //当前线程的类加载器 同一线程不太稳定 方法二: this.getClass().getResource("/"+path).toURI().getPath();//不会出...
分类:编程语言   时间:2015-03-12 15:12:10    阅读次数:218
java 获取src下包的文件的路径
getClass().getClassLoader().getResource("/sy/config/sheetMonitor-config.xml").getPath().replace("%20","")
分类:编程语言   时间:2015-03-03 11:59:12    阅读次数:155
如何把一个Python脚本加入Windows右键菜单
例如我有一个Python程序,叫getPath.py,用来获得我选中的文件的全路径名称。 getPath.py import sys if __name__ == '__main__': if len(sys.argv)!= 2: sys.exit('argv error!') ##sys.argv[1]就是输入的带路径文件名。 ##后面是对sys.a...
分类:编程语言   时间:2015-02-14 18:56:39    阅读次数:473
在servlet中读取配置文件的几种方式
String path = ServletDemo1.class.getClassLoader().getResource("db.properties").getPath(); //在servlet下,用ServletContext的getRealPath方法的得到资源库路...
分类:其他好文   时间:2015-02-10 14:57:00    阅读次数:263
286条   上一页 1 ... 23 24 25 26 27 ... 29 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!