Assume I am compiling the JDK from source downloaded from Oracle.
Now the JDK is extracted into /opt/oracle/jdk/
I am exporting the JAVA_HOME and the path environment variable in /etc/profile.
Is it the recommended way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s one way to do it. But consider that different users (or different applications) on the machine may need to use different Java installations. So other options are for users to set the environment variables in their personal shell profiles, and for applications to set them in wrapper scripts, “init.d” scripts or whatever.
There is no single “right” way to do this. Pick a way that best fits your needs.