title: Pyspark error: Java gateway process exited before sending its port number
body: <p>I am using Pyspark to run some commands in Jupyter Notebook but it is throwing error. I tried solutions provided in this link (<a href="https://stackoverflow.com/questions/31841509/pyspark-exception-java-gateway-process-exited-before-sending-the-driver-its-po">Pyspark: Exception: Java gateway process exited before sending the driver its port number</a>) 
  and I tried doing the solution provided here (such as Changing the path to C:Java, Uninstalling Java SDK 10 and reinstalling Java 8, still it is throwing me the same error.  </p>
  
  <p>I tried uninstalling and reinstalling pyspark, and I tried running from anaconda prompt as well still I am getting the same error. I am using Python 3.7 and pyspark version is 2.4.0. </p>
  
  <p>If I use this code, I get this error."Exception: Java gateway process exited before sending its port number". </p>
  
  <pre><code>from pyspark import SparkContext
  from pyspark.sql import SQLContext
  sc = SparkContext() 
  sqlContext = SQLContext(sc)
  from pyspark.mllib.linalg import Vector, Vectors
  from nltk.stem.wordnet import WordNetLemmatizer
  from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, Word2Vec
  </code></pre>
  
  <p>But If I remove sparkcontext from this code runs fine, but I would need spark context for my solution. Below code without spark context does not throw any error. </p>
  
  <pre><code>from pyspark import SparkContext
  from pyspark.sql import SQLContext
  from pyspark.mllib.linalg import Vector, Vectors
  from nltk.stem.wordnet import WordNetLemmatizer
  from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, Word2Vec
  </code></pre>
  
  <p>I would appreciate if I could get any help figuring this out. I am using Windows 10 64 bit operating system.</p>
  
  <p>Here is full error code picture. </p>
  
  <p><a href="https://i.stack.imgur.com/TOzLD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TOzLD.png" alt="enter image description here"></a></p>