Tag Archive: Linux

I have been trying to set variables for JAVA_HOME, etc., and couldn’t figure out why, when I entered “su johnsmith” (“johnsmith” being whatever the user’s name is) the user’s .bashrc wasn’t being picked up. It had two do with two things: first, using “su ” as opposed to “su – ” and, second, the difference in function between .bashrc and .profile. I found a helpful post from http://forums.fedoraforum.org/showthread.php?t=217954.

The .profile file is executed in a login shell and is where environment variables are set. .bashrc is where other stuff is kept. It is launched by a login. “su -” simulates a login, therefore launching the .profile, whereas “su” does not.

Here’s a helpful overview of the primary differences between Ubuntu and CentOS:



The apt repository only includes JDK version 6 or version 5.16. Versions of 5 prior to update 17 have a known security vulnerability, so you may want to use 5.18 instead. However, this requires a manual install. From Java-free install of Ubuntu/Debian, follow the instructions here, taking careful note of logging in as the different uses (e.g., follow the instructions explicitly): http://www.debianhelp.co.uk/debianjava.htm.

After this, you’ll need to set the JAVA_HOME variable and include it in your path. Include the following lines at the end of /etc/profile and /etc/bash.bashrc (see the explanation of Debian/Ubuntu environment variables here: https://help.ubuntu.com/community/EnvironmentVariables#System-wide):

export JAVA_OPTS="-server -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:NewSize=192m -XX:MaxNewSize=384m"
export JAVA_HOME="/usr/bin/java"
export JDK_HOME="${JAVA_HOME}"
export PATH="${JAVA_HOME}/bin:${PATH}"