I have the following problem. I have a txt file named password.txt on a unix server. I have a java class on the same server. I have to read the contents of the password.txt using this Java class. However, the Unix is running under root user and the root user does not have proper permissions to read this password.txt file directly. So, I have introduced a script and another java class which read the password.txt for me.
Basically, I call the script from the java class using Process and Runtime.exec(). The script invokes another java class which can read the password.txt file contents. But how do I get back the contents back to the java class which called the script? Someone suggested to assign the contents of the password.txt to an env variable and read that env variable in my java class. How do I implement this exactly. also, is this a good solution? Im very novice to UNIX and scripting. Pls help