META-INF下文件读取

protected String getProperty(String name) {
        String file = "/META-INF/jndi.properties";
        URL fileURL = this.getClass().getResource(file);
        if (fileURL != null) {
            try {
                props.load(this.getClass().getResourceAsStream(file));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return props.getProperty(name);
    }

猜你喜欢

转载自www.cnblogs.com/firstdream/p/9811049.html