properties文件路径的读取
2015-08-04 22:34
399 查看
System.out.println(System.getProperty("user.dir")); //这个是去工程的绝对路径的
System.out.println(Thread.currentThread().getContextClassLoader().getResource(""));//这个是去当前classpath的uri的!
new Properties().load(new FileInputStream("test.properties"));//这里说明test文件在工程的跟目录下!
new Properties().load(new FileInputStream("test/test.properties"));//说明,在工程底下的test的文件夹底下的文件test.properties!
ResourceBundle rs = ResourceBundle.getBundle("org.hello");
System.out.println(Thread.currentThread().getContextClassLoader().getResource(""));//这个是去当前classpath的uri的!
new Properties().load(new FileInputStream("test.properties"));//这里说明test文件在工程的跟目录下!
new Properties().load(new FileInputStream("test/test.properties"));//说明,在工程底下的test的文件夹底下的文件test.properties!
ResourceBundle rs = ResourceBundle.getBundle("org.hello");
相关文章推荐
- Docker容器的跨主机访问
- Docker源码分析(六):DOCKER DAEMON网络
- Linux伙伴系统
- Linux内存管理--伙伴系统和内存分配器
- openstack中region、az、host aggregate、cell 概念
- linux下各个查找命令
- Linux ipc------System V概述
- 开发openGL的一些基本配置
- linux内核内存的详细分配
- Linux自学笔记:04_Linux的常用命令
- OpenCV轮廓检测,计算物体旋转角度
- MyEclipse2014配置Tomcat开发JavaWeb程序JSP以及Servlet
- linux下 /usr/bin与/bin 以及/usr/sbin与/sbin目录的区别
- Apache Vysper
- Linux启动过程简析
- PANIC: Could not open:
- Docker源码分析(五):Docker Server的创建
- Docker源码分析(四):Docker Daemon之NewDaemon实现
- AOP系列(二)——为符合条件的目标对象创建代理
- Docker 容器日志的那些事儿