I am not able to get this resolved. I have installed hadoop, and it works fine. And the hadoop paths are proper. 

However, when I try to launch spark, I am a getting the following error

```
    /usr/local/spark-2.3.1-bin-hadoop2.7/bin$ spark-shell
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
    at org.apache.spark.internal.Logging$.org$apache$spark$internal$Logging$$isLog4j12(Logging.scala:205)
    at org.apache.spark.internal.Logging$class.initializeLogging(Logging.scala:119)
    at org.apache.spark.internal.Logging$class.initializeLogIfNecessary(Logging.scala:108)
    at org.apache.spark.deploy.SparkSubmit$.initializeLogIfNecessary(SparkSubmit.scala:71)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:128)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 6 more

```

I have searched for various alternatives, and tried, but error remains the same.

This is my `~/.bashrc` file. 

```
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_161
export PATH=$PATH:JAVA_HOME/bin
export HADOOP_HOME=/usr/local/hadoop

export PATH=$PATH:$HADOOP_HOME/bin

export HIVE_HOME=/usr/local/apache-hive-3.0.0-bin
export HIVE_CONF=/usr/local/apache-hive-3.0.0-bin/conf
export PATH=$HIVE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:/usr/local/hadoop/lib/*:.
export CLASSPATH=$CLASSPATH:/usr/local/apache-hive-3.0.0-bin/lib/*:.
export SPARK_HOME=/usr/local/spark-2.3.1-bin-hadoop2.7
export SPARK_CONF=/usr/local/spark-2.3.1-bin-hadoop2.7/conf
export PATH=$SPARK_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:/usr/local/spark-2.3.1-bin-hadoop2.7/lib/*:.

```

Also, the `sudo update-alternative --config java` and `sudo update-alternative --config javac

```
    There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
* 2            /usr/lib/jvm/jdk1.8.0_161/bin/java               0         manual mode

```

Another issue, which I have found out is that `java's` location is still `/usr/bin/java` and not the export path which I have set.

Please let me know, how to get over this.