I made a program in Java that uses two external databases. The paths to these databases are hard-coded inside my program code.
In order to make this program usable for other users on other computers (who should also install these two databases on their computers), I think that the path for these two databases should be added as environmental variables ? How could this be done ?
I am not a professional when it comes to environmental variables, so can you please advise what should be done in this case?
Thanks in advance
To get the value of an environment variable in Java, you write something like this:
(where
PATH_TO_DATABASEis the name of the environment variable). This usesSystem.getenv()to get a map of all environment variables.To set the value of an environment variable in Linux, your users can write something like this:
before running the program.