ITeye博客

java读取properties文件

qxmcool · 2009-10-15 13:53 · java · Markdown


package com.qxm.soap;

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

public class ReadProperties {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		ReadProperties rp = new ReadProperties();
		rp.getPropertiesFile();
	}

	public void getPropertiesFile() throws Exception{
		Properties pro = new Properties();
		//InputStream is = this.getClass().getClassLoader().getResourceAsStream("d:\\a.properties");
		InputStream is = new FileInputStream(new File("d:\\a.properties"));
		pro.load(is);
		System.out.println("a: "+pro.getProperty("export.types"));
		System.out.println("ok");
	}
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。