For #1, please find examples on the net
e.g.

http://www.scala-sbt.org/0.13/docs/Scala-Files-Example.html

For #2,

import <package-name>. getCheckpointDirectory

Cheers

On Sun, Jun 5, 2016 at 8:36 AM, Ashok Kumar <ashok34...@yahoo.com> wrote:

> Thank you sir.
>
> At compile time can I do something similar to
>
> libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.1"
>
> I have these
>
> name := "scala"
>
> version := "1.0"
>
> scalaVersion := "2.10.4"
>
> And if I look at jar file i have
>
>
> jar tvf utilities-assembly-0.1-SNAPSHOT.jar|grep Check
>   1180 Sun Jun 05 10:14:36 BST 2016
> com/databricks/apps/twitter_classifier/getCheckpointDirectory.class
>   1043 Sun Jun 05 10:14:36 BST 2016 getCheckpointDirectory.class
>   1216 Fri Sep 18 09:12:40 BST 2015
> scala/collection/parallel/ParIterableLike$StrictSplitterCheckTask$class.class
>    615 Fri Sep 18 09:12:40 BST 2015
> scala/collection/parallel/ParIterableLike$StrictSplitterCheckTask.class
>
> two questions please
>
> What do I need to put in libraryDependencies line
>
> and what do I need to add to the top of scala app like
>
> import java.io.File
> import org.apache.log4j.Logger
> import org.apache.log4j.Level
> import ?
>
> Thanks
>
>
>
>
>
> On Sunday, 5 June 2016, 15:21, Ted Yu <yuzhih...@gmail.com> wrote:
>
>
> At compilation time, you need to declare the dependence
> on getCheckpointDirectory.
>
> At runtime, you can use '--jars utilities-assembly-0.1-SNAPSHOT.jar' to
> pass the jar.
>
> Cheers
>
> On Sun, Jun 5, 2016 at 3:06 AM, Ashok Kumar <ashok34...@yahoo.com.invalid>
> wrote:
>
> Hi all,
>
> Appreciate any advice on this. It is about scala
>
> I have created a very basic Utilities.scala that contains a test class and
> method. I intend to add my own classes and methods as I expand and make
> references to these classes and methods in my other apps
>
> class getCheckpointDirectory {
>   def CheckpointDirectory (ProgramName: String) : String  = {
>      var hdfsDir = "hdfs://host:9000/user/user/checkpoint/"+ProgramName
>      return hdfsDir
>   }
> }
> I have used sbt to create a jar file for it. It is created as a jar file
>
> utilities-assembly-0.1-SNAPSHOT.jar
>
> Now I want to make a call to that method CheckpointDirectory in my app
> code myapp.dcala to return the value for hdfsDir
>
>    val ProgramName = this.getClass.getSimpleName.trim
>    val getCheckpointDirectory =  new getCheckpointDirectory
>    val hdfsDir = getCheckpointDirectory.CheckpointDirectory(ProgramName)
>
> However, I am getting a compilation error as expected
>
> not found: type getCheckpointDirectory
> [error]     val getCheckpointDirectory =  new getCheckpointDirectory
> [error]                                       ^
> [error] one error found
> [error] (compile:compileIncremental) Compilation failed
>
> So a basic question, in order for compilation to work do I need to create
> a package for my jar file or add dependency like the following I do in sbt
>
> libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.1"
> libraryDependencies += "org.apache.spark" %% "spark-sql" % "1.5.1"
> libraryDependencies += "org.apache.spark" %% "spark-hive" % "1.5.1"
>
>
> Any advise will be appreciated.
>
> Thanks
>
>
>
>
>
>
>
>

Reply via email to