Scarlet Li wrote:I am still not sure how to do this. For the environment variable, do I run the export command in the directory of the .profile file or do I "echo export EJBCA_HOME="/home/user/ejbca" " into the .profile file.
At this point this is really not a Java issue at all. It's an OS/shell/environment issue.
If you want a given user to have a given environment variable set at all times, then you need to have a line like
in an appropriate file.
What that file is depends on the user's shell, how his login session starts, etc. If you read the man pages for whatever shell that user is using (zsh, bash, ksh, csh, tcsh, sh, ...) it will tell you which files are read when. Some shells are login shells and some are not. Some of these files are read only for login shells.
In short, it is complicated and highly system- and context-dependent.
You're better off doing as suggested and just passing -Dkey=value on the command line and using System.getProperty, OR putting all the key/value pairs in a file that your app knows about and that can be specified at startup time and then using the java.util.Properties class to load that file.