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
  • 175
  • 9
user710818
  • 2,459
  • 3
  • 17
  • 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
  • 175
  • 9
Nils
  • 18,202
  • 11
  • 46
  • 82
5

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

export JAVA_HOME=/usr/java/jdk1.7.0_05
Carolus
  • 175
  • 9
jw013
  • 50,274
  • 9
  • 137
  • 141
  • 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