I have been storing my wallet inside my project's resources folder, and am able to access it using the following string just fine inside eclipse
final static String DB_URL = "jdbc:oracle:thin:@db_high?TNS_ADMIN="
+ (Database.class.getClassLoader().getResource("Wallet_DB")
.getPath().replaceFirst("/",""));
However, when I compile it into a jar, and then run it from command line I get the following error:
Exception in thread "main" java.nio.file.InvalidPathException: Illegal
char <:> at index 4:
file:C:/Users/Me/Documents/test.jar!/Wallet_DB\ojdbc.properties
I know I could fix this by just moving the wallet to be right next to my jar file, outside the project, and accessing it with a relative file path, but is there anyway to fix this so I can keep the wallet inside the jar?
JDBC can only accept a path which is accessible by new File(path)
. So here the path starts with "file:..." is invalid.