Install ExporterUtil inside my project folder (scala) - scala

I'm working on a scala source code, but when compiling, it doesn't find this import:
I'm new to scala, how can I bring this function to my scala (ExporterUtil)?
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import scala.collection.mutable.ArrayBuffer
import br.net.empresa.digital.exporter.ExporterUtil
When compiling, it doesn't find this directory (br.net.empresa.digital.exporter.ExporterUtil), how can I bring this dir to my folder?

Related

Error using apache spark for scala in intelliJ

I am trying to use apache spark in Scala in IntelliJ. I am importing spark like this
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.apache.spark.sql._
import org.apache.log4j._
however when I build my project I receive the error object apache is not a member of package org import org.apache.spark._
how can I fix this error?

Apache Spark and Scala required jars

I am new to Scala.
Can any one suggest me what are the jar files required for running Apache Spark with Scala in Linux environment.Below code was a piece of original code. I am getting exceptions like java.lang.NoSuchMethodError: org.jboss.netty.channel.socket.nio.NioWorkerPool.(Ljava/util/concurrent/Executor;I)V
java -cp ".:/opt/cloudera/parcels/CDH-5.7.1-1.cdh5.7.1.p1876.1944/jars/:./"
TestAll.scala
import org.apache.spark.SparkContext._
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext
import java.io._
import java.sql.{Connection,DriverManager}
import scala.collection._
import scala.collection.mutable.MutableList
object TestAll {
def main(args: Array[String]) {
val conf =new SparkConf().setAppName("Testing App").setMaster("local")
val sc=new SparkContext(conf)
println("Hello, world!")
}
}
You need to download Spark from here. Choose the "Pre-built with Hadoop" option. Then you can follow the directions of the Quick Start. This will get you through the Hello World. I am not sure which IDE you are using, but the most friendly for Scala is Intellij IDEA

Scala + Playframework 2.3.X importing dependencies

I am having problems importing two dependencies here is the import
import io.GooglePlayClient
import io.GooglePlayError
and I get this error
object GooglePlayError is not a member of package akka.io
[error] import io.GooglePlayError
object GooglePlayClient is not a member of package akka.io
[error] import io.GooglePlayClient
It seems it is prefixing the package where I am trying to import (akka) to this imports, and the is not able to import.
Thank you
You already have akka.io imported in scope. So, akka.io.GooglePlayError is tried. Instead use import _root_.io.GooglePlayError.
Another option is to import using the fully qualified name of the dependencies if available, that is
import com.yourcompany.io.GooglePlayClient
import com.yourcompany.io.GooglePlayError
If the io package is really a root package, you could consider refactoring your package structure to something like the above.

joda-time import stopped working in Spark shell

I'm trying to test some code in the Spark shell (spark v. 1.3.0, using Scala version 2.10.4) and in the past was able to import joda-time libraries like this:
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.DateTimeFormat
Today when I started the shell on my local machine, I'm getting:
scala> import org.joda.time.format.DateTimeFormat
<console>:19: error: object joda is not a member of package org
import org.joda.time.format.DateTimeFormat
^
scala> import org.joda.time.DateTime
<console>:19: error: object joda is not a member of package org
import org.joda.time.DateTime
^
scala> import org.joda.time._
<console>:19: error: object joda is not a member of package org
import org.joda.time._
^
As far as I know nothing's changed overnight. Anyone ever seen this before?
Not sure why I'm getting inconsistent behavior, but this seems to fix it.
spark-shell --jars ~/jars/joda-time-2.8.1.jar

cannot find jars for the imported Giraph packages

I was trying to run the SSSP giraph program from Eclipse. But I couldnt get the following packages imported
import org.apache.giraph.graph.BasicVertex;
import org.apache.giraph.graph.BspUtils;
import org.apache.giraph.graph.GiraphJob;
import org.apache.giraph.graph.EdgeListVertex;
import org.apache.giraph.graph.VertexReader;
import org.apache.giraph.graph.VertexWriter;
import org.apache.giraph.lib.TextVertexInputFormat;
import org.apache.giraph.lib.TextVertexInputFormat.TextVertexReader;
import org.apache.giraph.lib.TextVertexOutputFormat;
import org.apache.giraph.lib.TextVertexOutputFormat.TextVertexWriter;
I have followed the instruction in the giraph site to build Giraph and Hadoop.
Which jar should be imported to get the above packages?
Are you running the code for the correct version of Giraph? I think the imports you mention are for versions before 1.0.0, if you include a jar for a newer version it won't find them.