LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   problem setting JAVA_HOME (https://www.linuxquestions.org/questions/linux-general-1/problem-setting-java_home-344300/)

pkpro1 07-18-2005 10:58 AM

problem setting JAVA_HOME
 
hi, i did the following to set the java_home...

export java_home=/usr/java/j2re1.4.2_2
export PATH=$java_home/bin:$PATH

HOWEVER,

every time i open a new shell and type 'java'.... it says command not found. the java_home only works for the specific shell that i set it for. is there a way to make the java command a universal variable?

nadroj 07-18-2005 01:15 PM

i believe its because once you set it, it is only available for the time that the shell is open.. once you close it you would have to set it up again.
however, there should be a '.bashrc' file in your home folder, edit that. you will see the "PATH="... variable declared there, just add your java_home one before that, and edit the path like you did in your post, to include $java_home in the $path.

pkpro1 07-18-2005 03:53 PM

awesome. that worked like a charm

DinoFly 11-25-2007 07:32 AM

Quote:

Originally Posted by pkpro1 (Post 1753315)
awesome. that worked like a charm

But if I wana set up JAVA_HOME envirement for everybody who logs on my server is it the path /etc/bashrc ??? Just curious

DinoFly 11-25-2007 08:39 AM

Quote:

Originally Posted by DinoFly (Post 2970065)
But if I wana set up JAVA_HOME envirement for everybody who logs on my server is it the path /etc/bashrc ??? Just curious

Yep for those who wants to set up JAVA_HOME for all users on the server add 2 lines on /etc/bash.rc

export JAVA_HOME="pathtothejavadirectorium ex. /usr/java/jdkx.x.x/jre"
export PATH=$JAVA_HOME/bin:$PATH

I'm a rookie plz if some1 has a different opinion plz correct me.


Best regards

trickykid 11-25-2007 08:49 AM

Either /etc/bashrc or /etc/profile is the most common place for global environment for users who might not have their own .bashrc or .bash_profile in their home directory.


All times are GMT -5. The time now is 07:24 PM.