很简单的代码:
/*
 * Main.java
 *
 * Created on 2006年10月2日, 下午4:28
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */package javaapptest;import java.util.Properties;
import java.lang.reflect.*;
/**
 *
 * @author chen1
 */
public class Main {
    
    private Properties properties = new Properties();
    private final static String MAPPING_PROPERTIES = "mapping.properties";
    /** Creates a new instance of Main */
    public Main() {
        try {
            properties.load(getClass().getResourceAsStream(MAPPING_PROPERTIES));
        } catch (java.io.IOException e) {}
        }
        
        public Properties getProperties(){
            return properties;
        }
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            // TODO code application logic here
            Main main = new Main();
            String h = null;
            String w = null;
            h = main.getProperties().getProperty("hello");
            w = main.getProperties().getProperty("world");
            System.out.println(h+w);
            
        }
        
    }
    mapping.properties文件如下:
 # Sample ResourceBundle properties file
 hello=hello
 world=world!  运行出现说load()NullPointer,我对Properties类读取properties属性文件不是很了解,哪位大虾指点一下,不胜感激。