Hello World Program Example in Scala with Eclipse IDE
Main menu: Spark Scala Tutorial
In this Apache Spark Scala tutorial, you will learn how to create,
"Hello World" Scala application with Eclipse Scala IDE.
Scala application, project, package, objects, run configuration, and debug the application.
The motive is to get you guys familiar with Scala IDE.
I assume that you have already installed Eclipse Scala IDE, if not please refer to my previous post for installation (Windows | Mac users). Next, open Eclipse Scala IDE.
Scala Hello World Example
1. Create a new Scala project "hellooWorld"
Go to File → New → Project and enter hellooWorld in the project name field and click finish.
2. Create a new Scala Package "hellooWorld"
Right-click on the hellooWorld project in the Package Explorer panel → New → Package and enter the name hellooWorld and finish.
3. Create a Scala object "hello":
Expand the hellooWorld project tree and right-click on the hellooWorld package → New → Scala Object → enter hello in the Object name field and press finish.
4. Write the program to print the Hello World message.
package hellooWorld
object hello {
def main (args: Array[String]) {
println("Hello World")
}
}
5. Create a Run configuration for the Scala application:
Right-click on hello.scala in package explorer → Run As → Scala Application. Select the first matching item, the HellooWorld class, and click OK.
You can also define the configuration manually and run it. Just mention the project and class name.
That's it. You can see the output Hello World in the output console.
That's all guys! If you face any problem while running the program please mention it in the comments section below. Thank you.
Next: Spark Shell
Navigation menu
1. Apache Spark and Scala Installation
2. Getting Familiar with Scala IDE
3. Spark data structure basics
4. Spark Shell
5. Reading data files in Spark
6. Writing data files in Spark
7. Spark streaming
9. What's Artificial Intelligence, Machine Learning, Deep Learning, Predictive Analytics, Data Science?
Comments