【发布时间】:2020-03-29 16:26:52
【问题描述】:
我一直将我的钱包存储在我项目的资源文件夹中,并且可以在 eclipse 中使用以下字符串访问它
final static String DB_URL = "jdbc:oracle:thin:@db_high?TNS_ADMIN="
+ (Database.class.getClassLoader().getResource("Wallet_DB")
.getPath().replaceFirst("/",""));
但是,当我将它编译成 jar,然后从命令行运行它时,我收到以下错误:
Exception in thread "main" java.nio.file.InvalidPathException: Illegal
char <:> at index 4:
file:C:/Users/Me/Documents/test.jar!/Wallet_DB\ojdbc.properties
我知道我可以通过将钱包移动到项目外部的我的 jar 文件旁边并使用相对文件路径访问它来解决此问题,但无论如何可以解决此问题,以便我可以将钱包保留在里面罐子?
【问题讨论】:
标签: java ojdbc oracle-wallet