title: Creating sparkContext on Google Colab gives: `RuntimeError: Java gateway process exited before sending its port number`
body: <p>Following are the dependencies, which got installed successfully.</p>
  <pre><code>!apt-get install openjdk-8-jre
  !apt-get install scala
  !pip install py4j
  !wget -q https://downloads.apache.org/spark/spark-2.4.8/spark-2.4.8-bin-hadoop2.7.tgz
  !tar xf spark-2.4.8-bin-hadoop2.7.tgz
  !pip install -q findspark
  </code></pre>
  <p>Now to create the spark context:</p>
  <pre><code># Setting up environment variables
  import os
  os.environ[&quot;JAVA_HOME&quot;] = &quot;/usr/lib/jvm/java-8-openjdk-amd64&quot;
  os.environ[&quot;SPARK_HOME&quot;] = &quot;/content/spark-2.4.8-bin-hadoop2.7&quot;
  # export PYSPARK_SUBMIT_ARGS =&quot;--master local[2]&quot;
  
  # Importing and initating spark
  import findspark
  findspark.init()
  from pyspark.sql import SparkSession
  spark = SparkSession.builder.master(&quot;local[*]&quot;).appName(&quot;Test Setup&quot;).getOrCreate()
  sc = spark.sparkContext
  </code></pre>
  <p>I'm getting this error:</p>
  <blockquote>
  <p>RuntimeError: Java gateway process exited before sending its port
  number</p>
  </blockquote>
  <p>Please note that this is a colab notebook. Any kind of help would be great.</p>