Properties prop = new Properties(); // 获取servlet上下文的绝对路径,用上面介绍的二种方法之一 prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("huishangppt.properties"));