The slightly more scala-ish way to write this is:

```
sys.env("SPARK_JAVA_OPTS").foreach { opts => 
  sparkConf.set("spark.executor.extraJavaOptions", opts)
  sparkConf.set("spark.driver.extraJavaOptions", opts)
}
```