ant配置文件打包到class目录下

 

package com.Socket.event;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import com.Socket.util.LogUtil;

public class FrequencyProperty {

    private static ResourceBundle resourceBundle;

    static {
        String bundleName = "frequency"; // frequency.properties
        try {
            resourceBundle = ResourceBundle.getBundle(bundleName);
        } catch (MissingResourceException mre) {
            LogUtil.error("resource bundle missing: " + bundleName);
        }
    }

    public static int getProperty(String key) {

        String value = "";

        try {
            value = resourceBundle.getString(key);
        } catch (Exception e) {
            return 30;
        }

        return Integer.parseInt(value);
    }

    
}
原文地址:https://www.cnblogs.com/LcxSummer/p/14074252.html