---
title: "java读取properties文件"
author: "qxmcool"
date: "2009-10-15T13:53:16Z"
tags: []
slug: "java-properties"
draft: false
lastmod: "2009-10-15T13:53:16Z"
id: 491123
url: "https://qxmcool.iteye.com/blog/491123"
---

```java

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");
	}
}

```