SPARK-1565, update examples to be used with spark-submit script.
Fixed compilation errors in java 8 tests.