在属性文件中:
FolderPath=C:\pre-configured/Import.csv
在主类中,我将此路径作为方法加载的参数传递
Properties pro = new Properties();
new CSV().load(con,"pro.FolderPath", "VALIDATION");
但它给出的错误为:
pro.getProperty(FolderPath) (The system cannot find the file specified.)
请帮助将此路径作为参数传递到方法中。
最佳答案
您需要先加载属性文件:
FileReader reader = new FileReader( "your properties file path" );
Properties prop2 = new Properties();
prop2.load( reader );
prop2.list( System.out );
关于java - 如何从属性文件获取文件路径并将其作为参数传递到方法中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18302237/