user3169231 user3169231 - 4 months ago 15
Ini Question

Maven Project : How to specify a relative path in a *.ini file?

In a Maven project, I have a settings.ini file in this directory :

|-src/main/resources/configurations


The
settings.ini
file, needs to refer to another file,
tempDB.sql
under this directory :

|-src/main/resources/databases


So, I tried this relative path in my
settings.ini
file, but it didn't work:

temp_database = ../databases/tempDB.sql


How do I specify a relative path in my
.ini
file?

Answer

As the path will not be read by the .ini file itself, your code will use the project root directory as the start. In this case, you should use:

|-src/main/resources/databases/tempDB.sql