Possible Duplicate:
How do I set a user environment variable? (permanently, not session)

I use Suse. First I had jdk7 installed, so JAVA_HOME was:


I uninstalled jdk7 and installed jdk6, but I cannot figure out how to change JAVA_HOME. .bashrc and .profile don't contain anything about JAVA_HOME.

Is there another file?

  • 1
    yes, it is, I forgot about profile in my home directory. thanks. Please answer I will close the question – user710818 Jul 1 '12 at 6:47

Set environment variables in ~/.profile, e.g. by adding this line:

export JAVA_HOME=/usr/java/jdk1.7.0_05
  • I don't know Suse, but wouldn't it be better to define this in the system profile? JAVA_HOME is defined in /etc/profile on my Solaris server (a system with many accounts). – BellevueBob Jul 1 '12 at 20:44
  • 2
    @BobDuell Yes, you are right. If the java install was intended for all users system-wide, then /etc/profile would be the more appropriate place. – jw013 Jul 1 '12 at 20:57

Add to /etc/profile.local:

export JAVA_HOME=/usr/java/latest

That way it will be set for all users and will be independent of the release or patch-number. /usr/java/latest is a link to the latest installed version and exists since JDK/JRE 1.6

Not the answer you're looking for? Browse other questions tagged or ask your own question.