1. 程式人生 > >META-INF下檔案讀取

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);
    }