user2628641
user2628641

Reputation: 2154

PATH variable not function for hadoop

I installed hadoop in the following path, /home/myname/hadoop-2.7.2

/home/myname/hadoop-2.7.2/bin/hadoop  

contains the executable file "hadoop"

Now, I set my $PATH variable in .bashrc, and I did a echo $PATH, I get

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:
/home/myname/hadoop-2.7.2/:
/home/myname/hadoop-2.7.2/bin:
/home/myname/hadoop-2.7.2/sbin

i did some formatting here. When I run bin/hadoop, i get "No such file or directory", but when I run hadoop, i get the expected result.

Not sure what I did wrong here

Upvotes: 1

Views: 209

Answers (1)

jstuartmilne
jstuartmilne

Reputation: 4508

Thats because hadoop as you declared in your PATH variable is not on the bin directory but here :

/home/myname/hadoop-2.7.2/bin/hadoop  

so to run bin/hadoop you'll have to be in /home/myname/hadoop-2.7.2 directory.

the hadoop command is working for you thanks to your declaration in the PATH variable

If you want to make the command available for all users consider moving the folder to /opt for example.

and if using debian or a debian based distro take a look at this command

http://linux.die.net/man/8/update-alternatives

Im confused as what you want to achieve though. Since when you run hadoop you get to the expected result.

Upvotes: 2

Related Questions