Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

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

/usr/java/jdk1.7.0_05/

After I have deinstalled and installed jdk6, but cannot figure out how to change JAVA_HOME. .bashrc and .profile don't contain anything about JAVA_HOME. Does exist another file? Thanks.

share|improve this question

marked as duplicate by mattdm Jul 2 '12 at 17:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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
add comment

2 Answers 2

up vote 2 down vote accepted

Set environment variables in ~/.profile, e.g. by adding these lines:

JAVA_HOME=/usr/java/jdk1.7.0_05
export JAVA_HOME
share|improve this answer
    
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 comment

Add

JAVA_HOME=/usr/java/latest
export JAVA_HOME

to /etc/profile.local.

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

share|improve this answer
add comment

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