0
我導出了一個讀取2個配置文件的項目。然而,當我執行jar時,它會得到這個錯誤:Jar文件:在jar中加載配置文件
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.smart.ets.services.ConfigErrorException
... 3 more
[email protected]:~/Documents/Dropbox$ java -jar ETS.jar
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.sm
art.ets.services.ConfigErrorException
... 3 more
有什麼辦法解決這個問題?它運作,如果我運行項目(不是項目的jar文件)