Denver Denver - 3 years ago 189
Linux Question

Unable to run spark-shell from bin

I'm new to spark, I downloaded precompiled spark.

When I try to run spark-shell from bin folder on command line, it returns

:cd /users/denver/spark-1.6/bin


command not found

But if I run it like

:cd /users/denver/spark-1.6


it launches spark ..

can you please let me know why it is throwing error in the 1st case

Answer Source

The reason why you can not run the spark-shell command in first case is because of environment variable

The terminal searches for executables in $PATH. This is a Unix environment variable that lists directories containing system binaries (such as ls, echo, or gcc). If you call an executable that's not in a $PATH directory (such as spark-shell), you need to indicate its absolute path in the file system.

In the terminal . is a synonym for the current working directory, thus ./bin/spark-shell can work properly. You could equally well call ./some/path/bin/spark-shell.

Hope it helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download