4

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:

/usr/java/jdk1.7.0_05/

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?

Carolus
  • 212
  • 1
  • 10
user710818
  • 2,469
  • 3
  • 18
  • 12

2 Answers2

6

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

Carolus
  • 212
  • 1
  • 10
Nils
  • 18,492
5

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

export JAVA_HOME=/usr/java/jdk1.7.0_05
Carolus
  • 212
  • 1
  • 10
jw013
  • 51,212
  • 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 01 '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 01 '12 at 20:57