0

I have installed sun-java in archlinux kde by first building the package and then installing it. This is the way the environment variables are set in my machine: file: /etc/profile # /etc/profile

#Set our umask
umask 022

# Set our default path
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
    for profile in /etc/profile.d/*.sh; do
        test -r "$profile" && . "$profile"
done
unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

and file: /etc/profile.d/jdk.sh

export J2SDKDIR=/opt/java
export PATH=$PATH:/opt/java/bin:/opt/java/db/bin
export JAVA_HOME=/opt/java
export DERBY_HOME=/opt/java/db

what I understand from this is, jdk path should be set in the path environment variable but its not. But the attribute $JAVA_HOME is set correctly. Any reasons why am I facing this problem?

aash
  • 1,323
  • 1
  • 14
  • 22
  • In your PATH= /opt/java should go first other wise java installed in /usr/bin will be taken first. – kofemann May 03 '12 at 19:53
  • @geeky_sh what is the output of `echo $PATH`? – Tim Pote May 03 '12 at 19:58
  • echo $path /home/absolute/.rvm/gems/ruby1.9.3p0/bin:/home/absolute/.rvm/gems/ruby1.9.3p0@global/bin:/home/absolute/.rvm/rubies/ruby1.9.3p0/bin:/home/absolute/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/home/absolute/.rvm/bin – aash May 03 '12 at 20:18
  • @tigran there is no file named java found in /usr/bin – aash May 03 '12 at 20:19
  • wait, is it `echo $PATH` OR as you have written above `echo $path`. Variables in Linux/Unix/bash/ksh/etc_shell are case sensitive. make sure you're looking at the right variable. Please add a tag for the OS environment you are using, Linux,Unix,WindowsX. Also, it is better to edit your original question when answering a question about your environment, setup, inputs, expected output, and error messages. So, I'm advising you to edit your question to include output of `echo $PATH`. Good luck. – shellter May 04 '12 at 14:40

2 Answers2

0

/etc/profile and /etc/profile.d are processed only for login shells, so unless you're doing ssh into the machine where java is installed you won't get those variables.

To have them locally (e.g. when you open an xterm on a workstation) put them in the file /etc/bash.bashrc.

Hope this helps.

Epikuros
  • 229
  • 2
  • 4
0

Actually, it was a silly mistake on my part. I am using zsh shell. So I was required to put:

    export PATH=$PATH:$JAVA_HOME/bin 

in .zshrc file instead of .bashrc.

Shoe
  • 74,840
  • 36
  • 166
  • 272
aash
  • 1,323
  • 1
  • 14
  • 22