Here are two solutions. is one of the solutions I can think of:
It is easy to set an environment variable in a shell script and read it as a system property. i.e:.
echo "What is the password"
stty -echo
read server_password
stty echo
export server_password
Then in java:
password = System.getenv("server_password");
More difficult - encrypt the password using asymmetric encryption, and then pass the password, then you will need to decrypt it in your Java code.
Just my cuff ideas.
EDIT Removed the encryption of the password idea, because although this may prevent someone from deciding the password, it does not prevent anyone from using the encrypted password to launch the application.
EDIT 2: included stty -echo on @mpobrien suggestion
source
share