title: Setting GOOGLE_APPLICATION_CREDENTIALS environment variable in Scala
body: <p>I am running Spark-Shell with Scala and I want to set an environment variable to load data into Google bigQuery. The environment variable is <code>GOOGLE_APPLICATION_CREDENTIALS</code> and it contains <code>/path/to/service/account.json</code></p>
  
  <p>In python environment I can easily do,</p>
  
  <pre><code>import os 
  os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = "path/to/service/account.json"
  </code></pre>
  
  <p>However, I cannot do this in Scala. I can print out the system environment variables using,</p>
  
  <pre><code>scala&gt; sys.env
  </code></pre>
  
  <p>or</p>
  
  <pre><code>scala&gt; System.getenv()
  </code></pre>
  
  <p>which returns me a map of String Key,Value pairs. However,</p>
  
  <pre><code>scala&gt; System.getenv("GOOGLE_APPLICATION_CREDENTIALS") = "path/to/service/account.json"
  </code></pre>
  
  <p>returns an error</p>
  
  <pre><code>&lt;console&gt;:26: error: value update is not a member of java.util.Map[String,String]
  </code></pre>