$which java make sure the paths are valid for your installation (change if using 32bit version):
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java /usr/lib/jvm/java-6-openjdk-amd64/bin/javac Setup update-alternatives: sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6-openjdk-amd64/bin/javac" 1 sudo update-alternatives --set java /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java sudo update-alternatives --set javac /usr/lib/jvm/java-6-openjdk-amd64/bin/javac Alternatively, make sure the correct version is checked for both Java and compiler: sudo update-alternatives --config java sudo update-alternatives --config javac List the installed Java alternatives with: sudo update-alternatives --list java sudo update-alternatives --list javac On Wed, Apr 1, 2015 at 10:35 AM, Ravindra Kumar Naik <ravin.i...@gmail.com> wrote: > Hi, > > Creating batch program will not have the same effect. If you put the > variables in /etc/environment then it will be available to all users on the > operating system. HDFS doesn't run with root privileges. > You need to open the application with *sudo* or with root privileges to > modify it. > e.g. If you are using vi editor then its just *sudo* *vim > /etc/environment* (similar, if you are using other editors) and add > environment variables there. > > > On Wed, Apr 1, 2015 at 7:38 PM, Anand Murali <anand_vi...@yahoo.com> > wrote: > >> Mr. Ravindra: >> >> This is visible, however I am unable to modify it, eventhough I have >> admin priveleges. I am new to the Linux environment. Shall be glad if you >> did advise. However, as I told you earlier, I have created a batch program >> which contains, JAVA_HOME setting, HADOOP_INSTALL setting and PATH setting. >> I have rfun this file but I am still unable to start the daemons. I am >> following Tom Whyte's -Hadoop definitive Guide book instructions on how to >> install Hadoop. >> >> at $hadoop version works. I am able to format namenode, but fail to start >> daemons. >> >> Reply most welcome. >> >> Thanks >> >> Anand Murali >> 11/7, 'Anand Vihar', Kandasamy St, Mylapore >> Chennai - 600 004, India >> Ph: (044)- 28474593/ 43526162 (voicemail) >> >> >> >> On Wednesday, April 1, 2015 7:04 PM, Ravindra Kumar Naik < >> ravin.i...@gmail.com> wrote: >> >> >> Are you sure that its not there, could you please check the output of >> this command >> >> ls /etc/env* >> >> >> >> On Wed, Apr 1, 2015 at 6:55 PM, Anand Murali <anand_vi...@yahoo.com> >> wrote: >> >> Mr. Ravindra: >> >> I am using Ubuntu 14. Can you please provide the full path. I am logged >> in as root and it is not found in /etc. In any case what you have suggested >> I have tried creating a batch file and it does not work in my installation. >> >> Thanks >> >> >> >> Anand Murali >> 11/7, 'Anand Vihar', Kandasamy St, Mylapore >> Chennai - 600 004, India >> Ph: (044)- 28474593/ 43526162 (voicemail) >> >> >> >> On Wednesday, April 1, 2015 6:50 PM, Ravindra Kumar Naik < >> ravin.i...@gmail.com> wrote: >> >> >> I meant /etc/environment. It should be present if you are using Ubuntu. >> >> Regards, >> Ravindra >> >> On Wed, Apr 1, 2015 at 6:39 PM, Anand Murali <anand_vi...@yahoo.com> >> wrote: >> >> Mr. Ravindra >> >> I dont find any etc/environment. Can you be more specific please. I have >> done whatever you are saying in a user created batch program and run it, >> followed by running hadoop-env.sh and it still does not work. >> >> Thanks >> >> Anand Murali >> 11/7, 'Anand Vihar', Kandasamy St, Mylapore >> Chennai - 600 004, India >> Ph: (044)- 28474593/ 43526162 (voicemail) >> >> >> >> On Wednesday, April 1, 2015 6:10 PM, Ravindra Kumar Naik < >> ravin.i...@gmail.com> wrote: >> >> >> Hi, >> >> If you are using Ubuntu then add these lines to /etc/environment >> JAVA_HOME=*<actual path to jdk>* >> >> PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME/bin" >> >> Please put the actual path to JDK in the first line. >> >> Regards, >> Ravindra >> >> >> On Wed, Apr 1, 2015 at 5:50 PM, roland.depratti <roland.depra...@cox.net> >> wrote: >> >> Anand, >> >> Sorry about that, I was assuming Redhat/Centos. >> >> For Ubuntu, try sudo update-alternatives --config java. >> >> >> >> Sent from my Verizon Wireless 4G LTE smartphone >> >> >> -------- Original message -------- >> From: Anand Murali <anand_vi...@yahoo.com> >> Date: 04/01/2015 7:22 AM (GMT-05:00) >> To: user@hadoop.apache.org >> Subject: Re: Hadoop 2.6 issue >> >> Dear Mr.Roland: >> >> The alternatives command errors out. I have the extracted version of the >> Oracle JDK7. However I am ignorant regarding its installation on Ubuntu. >> Can you point me to installation material so that I can look up and try. >> >> Thanks >> >> Regards, >> >> Anand Murali >> 11/7, 'Anand Vihar', Kandasamy St, Mylapore >> Chennai - 600 004, India >> Ph: (044)- 28474593/ 43526162 (voicemail) >> >> >> >> On Wednesday, April 1, 2015 4:33 PM, Roland DePratti < >> roland.depra...@cox.net> wrote: >> >> >> Anand, >> >> My guess is that your alternatives setup isn’t complete. >> >> At a prompt, as su, run the command ‘alternatives - - config java’. Make >> sure that the oracle version is listed and is marked as the active one. >> >> If it is not, go through the steps to make sure it is. >> >> - rd >> >> *From:* Anand Murali [mailto:anand_vi...@yahoo.com] >> *Sent:* Wednesday, April 01, 2015 5:42 AM >> *To:* user@hadoop.apache.org >> *Subject:* Re: Hadoop 2.6 issue >> >> I continue to get the samede error.I >> >> export JAVA_HOME=/home/anand_vihar/jdk1.0.7_u75 (in hadoop-env.sh) >> >> >> when I echo $JAVA_HOME it shows me the above path but when I $java >> -version, it gives me openjdk version >> >> start-dfs.sh ....... errors out saying JAVA_HOME not set., but echo shows >> JAVA_HOME. Strange !! >> >> >> Regards, >> >> Anand Murali >> 11/7, 'Anand Vihar', Kandasamy St, Mylapore >> Chennai - 600 004, India >> Ph: (044)- 28474593/ 43526162 (voicemail) >> >> >> >> >> >> >> >> >> >> >> >> >