Spark-sql : createOrReplaceTempView error while converting the DataFrame to spark Sql Table

scala> val emp = sc.textFile("/user/supascale/siva/emp4.txt")
emp: org.apache.spark.rdd.RDD[String] = /user/supascale/siva/emp4.txt MapPartitionsRDD[1] at textFile at :27

scala> val emp_df = emp.map(x=>(x.split(" “)(0),x.split(” “)(1),x.split(” ")(2))).toDF(“name”,“id”,“city”)
emp_df: org.apache.spark.sql.DataFrame = [name: string, id: string, city: string]

scala> emp.collect
res0: Array[String] = Array("vikram 201 hyd ", "sugunakar 202 hyd ", siva 101 blr, anu 102 che, ram 201 hyd, sam 203 blr)

scala> emp_df.collect
res1: Array[org.apache.spark.sql.Row] = Array([vikram,201,hyd], [sugunakar,202,hyd], [siva,101,blr], [anu,102,che], [ram,201,hyd], [sam,203,blr])

scala> emp_df.printSchema
root
|-- name: string (nullable = true)
|-- id: string (nullable = true)
|-- city: string (nullable = true)

scala> emp_df.createOrReplaceTempView(“emp_table”)
:32: error: value createOrReplaceTempView is not a member of org.apache.spark.sql.DataFrame
** emp_df.createOrReplaceTempView(“emp_table”)**
** ^**

“.createOrReplaceTempView()” is available in Spark 2. You are running the above program in Spark1. So you are getting the error.