很多时候,我们都将配置文件放在eclipse的src目录下,这个位置,相当于,当导出可执行jar包后,配置文件放在和jar同级的目录中,比如jar包放在/opt目录下,则配置文件放在/opt下,则jar包就可以读取配置文件中的内容.此时,java代码中可以通过 String path=CommonOperation.class.getResource("/").getPath(); FileInputStream fin = new FileInputStream(path+"
说明:upload.properties属性文件在resources下 import java.io.IOException;import java.io.InputStream;import java.util.Properties;import java.util.ResourceBundle; public class Test { private static Properties pro ; static{ InputStream inputStream = Test.class.ge