Properties工具类
package com.uwl.sl.util;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static String getArg(String arg) {
Properties properties = new Properties();
InputStream insss = null;
try {
insss = PropertiesUtil.class.getResourceAsStream("/conf/comment.properties");
if(insss != null) {
properties.load(insss);
// properties.load(new FileInputStream("/conf/comment.properties"));
String resultarg = properties.getProperty(arg);
return resultarg;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (insss != null) {
try {
insss.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return "";
}
}