title: Trying to access s3 bucket using scala application
body: <p>I want to access amazon s3 bucket using scala application. I have set up the scala IDE in my eclipse. But when i try to run the >application on my local (Run As --> Scala Application) , it gives the following >error on the console. Error: Could not find or load main class org.test.spark1.test I an trying to run  a simple wordcount application in which i am accessing a >file that is stored in my S3 bucket and storing the results in another file. Please make me understand what might the problem be. </p>
  
  <p>Note: I am using eclipse maven project. My scala application code is :</p>
  
  <pre><code>package org.test.spark1
  import com.amazonaws._
  import com.amazonaws.auth._
  import org.apache.spark.SparkConf
  import org.apache.spark.SparkContext
  import com.amazonaws.services.s3._
  import com.amazonaws.services.s3.model.GetObjectRequest
  import java.io.File;
  object test extends App {
  def main(args: Array[String])  {
  val myAccessKey = "here is my key"
  val mySecretKey = "here is my secret key"
  val bucket = "nlp.spark.apps"
  val conf = new SparkConf().setAppName("sample")
  val sc = new SparkContext(conf)
  val yourAWSCredentials = new BasicAWSCredentials(myAccessKey, mySecretKey)
  val amazonS3Client = new AmazonS3Client(yourAWSCredentials)
  // This will create a bucket for storage
  amazonS3Client.createBucket("nlp-spark-apps2")
  val s3data = sc.textFile("here is my url of text file")
  s3data.flatMap(line =&gt;
    line.split(" "))
    .map(word =&gt;
      (word, 1))
    .reduceByKey(_ * _)
    .saveAsTextFile("/home/hadoop/cluster-code2.txt")
  }}      
  </code></pre>