You are not logged in.
Hi,
I have CrunchBang 9.04.01 and am trying to set up my java development environment.
Where do I set my environment variables like JAVA_HOME, ANT_HOME etc?
There was no ~/.bash_profile so I created one as below :
#!/bin/bash
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
export ANT_HOME=/home/myhomedir/Development/ant
export PATH=$PATH:$ANT_HOME/bin
But each time I log in, open a terminal and type echo $JAVA_HOME, nothing echoes.
However if I type "source ~/.bash_profile" and then type echo $JAVA_HOME, I get the correct value echoed for my JAVA_HOME
My question is, isn't .bash_profile supposed to run automatically at login anyway, why do I have to manually do a source each time?
How can I make it run at log in so that I don't have to run a source at the terminal?
Thanks
Offline
if you want to have some stuff to be run when you open a termianl add it to ~/.bashrc
I think you can also add the path of other files there.(maybe like "source ~/.bash_profile")
If you want to have some stuff run at login you can add it to ~/.config/openbox/autostart.sh but don't forget the '&' at the end of each line.
If you have more questions just ask
Offline
Where do I set my environment variables like JAVA_HOME, ANT_HOME etc?
There was no ~/.bash_profile so I created one...
Does '~/.profile' exist on your system? If it does, you could try popping them in there.
Ex-developer of #! CrunchBang. Follow me on Twitter 
Offline
^ Also note that the comments on top of .profile says it will not be loaded if .bash_profile exist...
But I'm not sure if it, too, will load when you start a terminal, since it's supposed to be loaded for a login shell. If you use gdm or such you should probably put it in ~/.config/openbox/autostart.sh as luc said, [assuming you want those variables to set outside of interactive shell, say for eclipse / geany)
a.
Offline
When you log in, via gdm or directly on a tty, .bash_profile or .profile will be executed, so if you open a terminal in a graphic environment it will be a subshell of that login shell and should inherit the variables you set in that file. (Also, .bashrc is executed every time you open such a terminal.) Scripts, run from a terminal or in the background, should also inherit those variables from *profile ( but not from .bashrc if in the background. )
Different systems seem to have different rules, but gdm on Ubuntu uses .profile I think.
Another complication is if you were using a different shell from bash: dash for example. Any file with bash in the name should be ignored, but eg .profile will be read. I haven't got a .bash_profile on Ubuntu-based #! 9.04, but Debian might be different... A common practice seems to be to put your settings in one file, and source it from the other so it should work either way. eg put settings in .profile and put this in .bash_profile:
[[ -r ~/.profile ]] && . ~/.profileConfused enough? Try googling:
http://tldp.org/LDP/Bash-Beginners-Guid … 03_01.html
http://www.uluga.ubuntuforums.org/showt … ?t=1241288
http://stackoverflow.com/questions/4154 … nvironment
Last edited by johnraff (2010-06-03 05:20:12)
John Please help us keep your forums manageable.
--------------------
( a boring Japan blog , idle twitterings and GitStuff )
#! forum moderator
Offline
http://www.cyberciti.biz/faq/ssh-passwo … r-scripts/
I'm following the above tutorial on keychains and created a .bash_profile file coz I didn't find one. However the commands appended in the .bash_profile file do not run automatically on startup.
Im running out of options to try so any help would be greatly appreciated.
This is Linux country. If you listen carefully, you can hear Windows reboot...
Offline
http://www.cyberciti.biz/faq/ssh-passwo … r-scripts/
I'm following the above tutorial on keychains and created a .bash_profile file coz I didn't find one. However the commands appended in the .bash_profile file do not run automatically on startup.
Im running out of options to try so any help would be greatly appreciated.
Solved:
ssh-askpass was not installed and was needed to help things along. Once I figured that out the rest was fun
This is Linux country. If you listen carefully, you can hear Windows reboot...
Offline
/spambot post removed
-s11
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.