jdk1.6

package read;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class FileRead {

public static void main(String[] args) {
        FileRead re=new FileRead();
        String x=re.gete();
        System.out.println(x);
    }           
    public String gete(){
        Properties props = new Properties();
        System.out.println(new File("").getAbsolutePath());
        try {
            props.load(new InputStreamReader(new FileInputStream(new File("").getAbsolutePath()+"/src/config/read.properties"), "UTF-8"));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }   
        String isuse = props.getProperty("ISUSE");
        return isuse;
    }

}

jdk1.7及以上

import java.io.InputStream;
import java.util.Properties;

Properties pro = new Properties();
            try(InputStream is = getClass().getResourceAsStream(
                    "/config/Multi-Language-Configuration.properties")) {
                pro.load(is);
            } catch (Exception e) {           
            }
            String isuse = pro.getProperty("ISUSE");

最新文章

  1. d3 document
  2. JavaScript基础—闭包,事件
  3. PHP中PSR-[0-4]代码规范
  4. (C#) Interview Questions.
  5. 《linux内核设计与实现》读书笔记第一、二章
  6. 2014.12.05(解决eclipse的adb打不开)
  7. QT的文本加密方法(寒山居士)
  8. 菜农群课笔记之ICP与ISP----20110412(整理版)
  9. 关于接收POST请求 $GLOBALS['HTTP_RAW_POST_DATA']
  10. HDU 5776 sum
  11. Docker入门01——Image
  12. treeview插件使用:根据子节点选中父节点
  13. Maven编译问题
  14. Let's Encrypt,站点加密之旅
  15. qt布局管理-缩放、多窗口切换
  16. ASP.NET MVC 4 从示例代码展开,连接默认SQL Server数据库
  17. 使用 ISO镜像配置 本地yum 源(RHEL, CentOS, Fedora等适用)
  18. 《Inside C#》笔记(十五) 非托管代码 上
  19. Cpu 主频与睿频
  20. IdentityServer4-端点

热门文章

  1. 简单python脚本,将jupter notebook的ipynb文件转为pdf(包含中文)
  2. mvn ssm 异常 org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'multipartResolver'
  3. Spring-Cloud-Eureka实例
  4. 配置centos7阿里镜像源和epel源
  5. Linux下MySQL的操作(最全)
  6. [Codeforces1148C]Crazy Diamond——构造
  7. c标签页面进行解析json
  8. QQ 为什么以 UDP 协议为主,以 TCP 协议为辅?
  9. 作妖 | "该文件没有与之关联的程序来执行该操作..."的解决方法(删除快捷方式小箭头所致)
  10. arcgis python 刷新