Ububtu: Path setting problem

Fr0z3n

Disciple
I have just started trying my hand with linux. but got few problems for which i need help.

I want to set path for java permanently but even after editing .bash_profile or /etc/profile or few other files i am not getting java in my current path.

Each time i have to set up path for java manually.
Same happenes for setting http_proxy.
When i add http_proxy manually through the console it works for 'apt-get'
but editing /etc/profile and setting http_proxy there doesn't work.

May be i am not doing the correct thing. Please guide me.
 
Thats strange, setting up the path in $HOME/.bash_profile works perfectly for me. All you have to do is to add the following line to the file

Code:
export PATH=/path/to/java/bin:$PATH

Adding $PATH at the end is important, such that the old path variables are not destroyed. This should certainly work, as long as bash is the shell you are using.

If you want to set some other variable, replace PATH with the variable name.

Also, here are some sites which may be helpful, if you haven't seen them already -

http://www.dougsparling.com/comp/howto/linux_java.html
http://www.geocities.com/tipsforlinux/articles/11.html
 
Highly unlikely to be something apart from bash, unless you changed it yourself ;) anyway type help and see whether it says GNU bash in the first line.

BTW, if the steps dont work, run a "set | grep PATH" and see whether the proper locations are displayed in the PATH line.
 
ya echo $SHELL ;) i work on bash shell in linux and soon as i move onto solaris damn it korn really frustruating but i don't like to change to bash in solaris lol ;)

Regards.
 
Here is the output of 'set' command on my shell. Might help you to debug my problem.

As you can see the path in not getting added when i put it in my $HOME/.bash_profile. But the same command works when i type it on shell.

Is there any place where i should configure .bash_profile as my configuration file for bash shell?

BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="00" [2]="16" [3]="1" [4]="release" [5]="i386-pc-linux-gnu")
BASH_VERSION='3.00.16(1)-release'
COLORTERM=gnome-terminal
COLUMNS=80
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-GSanEjNxSJ
DESKTOP_SESSION=default
DIRSTACK=()
DISPLAY=:0.0
EUID=0
GDMSESSION=default
GDM_XSERVER_LOCATION=local
GNOME_DESKTOP_SESSION_ID=Default
GNOME_KEYRING_SOCKET=/tmp/keyring-0l0bjm/socket
GROUPS=()
GTK_RC_FILES=/etc/gtk/gtkrc:/home/frozen/.gtkrc-1.2-gnome2
HISTFILE=/root/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/root
HOSTNAME=FR0Z3N
HOSTTYPE=i386
IFS=$' \t\n'
LANG=en_IN
LANGUAGE=en_IN:en
LINES=24
LOGNAME=root
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:eek:r=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
LS_OPTIONS=--color=auto
MACHTYPE=i386-pc-linux-gnu
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
PIPESTATUS=([0]="0" [1]="0")
PPID=7582
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w \$ '
PS2='> '
PS4='+ '
PWD=/home/frozen
SESSION_MANAGER=local/FR0Z3N:/tmp/.ICE-unix/7335
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SSH_AGENT_PID=7380
SSH_AUTH_SOCK=/tmp/ssh-jetZAB7335/agent.7335
SUDO_COMMAND=/usr/bin/x-terminal-emulator
SUDO_GID=1000
SUDO_UID=1000
SUDO_USER=frozen
TERM=xterm
UID=0
USER=root
USERNAME=frozen
WINDOWID=44040289
XAUTHORITY=/tmp/libgksu1.2-SHDdVl/.Xauthority
_=
 
here is my .bash_profile file. Java (J2sdk1.5) is present at location '/usr/bin/java/bin'

# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs
#umask 022

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
# set PATH for java
PATH=/usr/bin/java/bin:$PATH

export PATH
 
well thanks to those who helped. I have finally managed to put the path in my .bashrc file and it's working.
I don't know why .bash_profile is not working. anyway i got my problem solved.
 
KingKrool said:
if that does not work, try setting it in /etc/bashrc and /etc/profile

i already did that. don't know why it was not working?
but it's working perfectly fine when setting the path in .bash_profile.

My friends are getting similar problems. We had a mass switchover to Ubauntu in college since they started giving free cd's :)
 
Back
Top