今天终于把maven-bundle-plugin不能导出META-INF中的内容到Export-Package中的问题解决了,因为产品用的是OSGI框架,用到的第三方JAR包需要加载META-INF/XX/XX.xml这个内容,但在运行的时候getResource返回null。经一番调查发现META...
分类:
Web程序 时间:
2015-09-14 00:25:58
阅读次数:
287
第一种: File f = new File(this.getClass().getResource("/").getPath()); System.out.println(f); 结果: C:\Documents%20and%20Settings\Administrator\workspace\p...
分类:
编程语言 时间:
2015-09-10 12:55:53
阅读次数:
189
在线上运行多年的代码, 为何线下测试出现 BUG, 一个符号的差别, 后面隐藏的是什么......
分类:
其他好文 时间:
2015-08-28 07:22:30
阅读次数:
140
String url = TemplateBuilder.class.getClassLoader().getResource("").getPath(); String java_command = System.getProperties().getProperty...
分类:
编程语言 时间:
2015-08-19 10:56:39
阅读次数:
170
//通过java类获取类名.class.getResource("/").getPath() + "文件名"例子:HttpConnectionUtil.class .getResource("/").getPath() + "cas-service.propertie...
分类:
编程语言 时间:
2015-08-11 21:22:02
阅读次数:
135
System.out.println(System.getProperty("user.dir"));? //这个是去工程的绝对路径的 ??System.out.println(Thread.currentThread().getContextClassLoader().getResource(""));//这个是去当前classpath的uri...
分类:
其他好文 时间:
2015-08-04 23:26:19
阅读次数:
341
Activity原理: .java.xml.resource(数据)之间的调用: java可以通过xml布局文件获取resource数据,value/string.xml.还有别的;也可以通过.java.this.getResource().***(数据资源在R文件中的定位) Activi...
分类:
移动开发 时间:
2015-07-31 21:40:38
阅读次数:
135
Java中取资源时,经常用到Class.getResource和ClassLoader.getResource,这里来看看他们在取资源文件时候的路径问题。转自:http://www.cnblogs.com/yejg1212/p/3270152.htmlClass.getResource(String...
分类:
其他好文 时间:
2015-07-11 06:42:17
阅读次数:
131
经常会遇到通过java类获取项目路径,并且通过该相对路径或者绝对路径加载资源文件的问题。通常最常用的的两种方式是通过classLoader或者class的getResource()方法。 public?static?final?String?getPath(){
...
分类:
编程语言 时间:
2015-07-08 13:07:34
阅读次数:
140
导入包importjava.io.BufferedInputStream;importjava.io.FileInputStream;importjava.io.InputStream;importjava.util.Properties;Stringpath=this.getClass().getResource("/").getPath();InputStreamin=newBufferedInputStream(newFileInputStream(path+name));Propertiesp=..
分类:
其他好文 时间:
2015-06-27 00:04:49
阅读次数:
139