How to write a Scala program in script mode

0 votes
How to write a Scala program in script mode?
Nov 16, 2020 in Big Data Hadoop by Rajiv
• 8,880 points
148 views

1 answer to this question.

0 votes

Open notepad and add the following code to it.

Example

object HelloWorld {
   /* This is my first java program.  
   * This will print 'Hello World' as the output
   */
   def main(args: Array[String]) {
      println("Hello, world!") // prints Hello World
   }
}

Save the file as − HelloWorld.scala.

Open the command prompt window and go to the directory where the program file is saved. The ‘scalac’ command is used to compile the Scala program and it will generate a few class files in the current directory. One of them will be called HelloWorld.class. This is a bytecode that will run on Java Virtual Machine (JVM) using the ‘scala’ command.

Use the following command to compile and execute your Scala program.

\> scalac HelloWorld.scala
\> scala HelloWorld

Output

Hello, World!
answered Nov 16, 2020 by Gitika
• 65,930 points

Related Questions In Big Data Hadoop

0 votes
1 answer

How to write a file in hdfs with Java?

You could pass the URI when getting ...READ MORE

answered Sep 26, 2018 in Big Data Hadoop by digger
• 26,720 points
2,609 views
0 votes
1 answer

How to write a file in HDFS using Java Programming language?

Define the HADOOP_CONF_DIR environment variable to your Hadoop configuration ...READ MORE

answered Sep 28, 2018 in Big Data Hadoop by Frankie
• 9,810 points
1,427 views
0 votes
1 answer

How to Sqoop in a Java Program?

You can use the following sample code for ...READ MORE

answered Jul 22, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
777 views
0 votes
2 answers

How to use scoop in a Java Program

There is a trick which worked out ...READ MORE

answered Sep 4, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
602 views
0 votes
1 answer

Writing File into HDFS using spark scala

The reason you are not able to ...READ MORE

answered Apr 5, 2018 in Big Data Hadoop by kurt_cobain
• 9,390 points
13,210 views
0 votes
3 answers

How to transpose Spark DataFrame?

Please check the below mentioned links for ...READ MORE

answered Dec 31, 2018 in Apache Spark by anonymous
15,600 views
0 votes
1 answer

What are the options for hadoop on scala?

Definitely check out Scalding. Speaking as a user ...READ MORE

answered Aug 21, 2018 in Big Data Hadoop by Frankie
• 9,810 points
172 views
0 votes
1 answer

Setting textinputformat.record.delimiter in spark

I got this working with plain uncompressed ...READ MORE

answered Oct 10, 2018 in Big Data Hadoop by Omkar
• 69,150 points
1,262 views
0 votes
1 answer

how to execute pig script in MapReduce mode?

Hey, To execute pig script we can use ...READ MORE

answered May 7, 2019 in Big Data Hadoop by Gitika
• 65,930 points
597 views
0 votes
1 answer

How to use Hbase shell in a bash script?

Hello, To write scripts with HBase shell it includes non-interactive mode, ...READ MORE

answered May 29, 2019 in Big Data Hadoop by Gitika
• 65,930 points
1,305 views