Not able to run sbt package command

sbt

#1

Hi Team,

I am getting command not found error when I am trying to run ‘sbt package’ command.

Can you please help to setup the sbt?

Thanks,
Hari.


#2

@harinatha:


#3

Thanks Venkat for your quick response.

But, I would like to run the sbt in the Itversity lab. Can you please help me to fix the sbt setup in itversity lab


#4

@harinatha:

1.The base directory for my application is:
/home/<YOUR_USER_ID>/scalacode/retail

  1. In the base directory, we have to create a file called build.sbt
    /home/<YOUR_USER_ID>/scalacode/retail $ vi build.sbt

name := “retail” # application name
version := “1.0” # application version
scalaVersion := “2.10.6” # Scala version

Save and Exit from vi (:wq! or :x)

  1. Make sure no typos in build.sbt file

  2. Once build.sbt ready, we can run sbt package

/home/<YOUR_USER_ID>/scalacode/retail/src/main/scala $ sbt package

We should see [SUCCESS] msg in green color
It has compiled our source code into classes and build jar file
Before creating jar, it also download the packages based on application version & scala Version then create classes such as dependencies used in application

  1. After step#4 successful, copy your jar file on to cluster into your current directory (.) using SCP
  2. Use spark-submit with required config to run your code on cluster

Note: Make sure that, you are always in your base directory while you perform steps 1 through 4.

Hope this helps.
Thanks
Venkat


#5

Thanks Venkat. I have followed exactly the same steps.

But, I am getting the following error, when I ran the ‘sbt package’ command

[harinatha@gw03 scalademo]$ sbt package
-bash: sbt: command not found

Please help me to resolve this issue. Thanks!


#6

@harinatha:

Can you please check if sbt installed in your home directory?
$ cd /home/<YOUR_USER_ID> $ sbt

If you face error here, Please google sbt , download and install into your home directory.

Note: I missed this point. Before you run $ sbt package , you can also run $ sbt console so your build.sbt file will be validated by system.

Thanks
Venkat


#7

Thanks Venkat. sbt is not installed in my home directory. I am getting following command not found error when I ran sbt

[harinatha@gw03 ~]$ sbt
-bash: sbt: command not found

I am not sure, how to install the sbt under the itversity lab. But, I did installed on my windows machine. I want to practice using the itversity lab


#8

@harinatha:

If you have access CCA175 - Scala course in Udemy, go to video 16 and follow. Otherwise , search install SBT in www.itversity.com and follow instructions.
Thanks
Venkat


#9

I am able to install sbt in my physical machine. But, I am NOT sure, how to install the sbt under my itversity lab login ‘harinatha’

This is were, I have struck from the past few days.

Support Team, Can you please install sbt under my itversity lab login ‘harinatha’

My user name - harinatha


#10

@harinatha Now you can run SBT commands. Let us know the status.


#11

Thank you Balu. It’s working now.

Thanks,
Hari.


#12