Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Scala: Hello World project in Eclipse

 

Prerequisite:

Install Scala IDE in Eclipse.

 

Step 1: Open Eclipse. File -> New -> Other.

 

Search for scala.

 


 

Select ‘Scala Project’ and click on Next button.

 

Give the project name as ‘hello-world-scala’.

 



Click on Finish button. Project structure looks like below.

 

 


Step 2: Create new package ‘com.sample.app’.

 

Right click on the project ‘hello-world-scala’.

 

File -> New -> Scala Package Object.




Give the package name as ‘com.sample.app’.

 

 


Click on Finish button.

 

Step 3: Define Mainapp class.

 

Right click on the package ‘com.sample.app’ -> New -> Scala App.

 

 


Give the app name as com.sample.app.MainApp.

 

 


Click on Finish button.

 

MainApp generated code looks like below.

package com.sample.app

object MainApp extends App {

}

 

Add some  println messages to the body of MainApp class and run the application.

 

MainApp.java

 

package com.sample.app

object MainApp extends App {

println("Welcome to Scala Programming!!!")

}

 

Step 4: Run MainApp class.

 

Right click on MainApp -> Run As -> Scala Application.

 

 

 


You will see below message in console.

 

Welcome to Scala Programming!!!

 


 

 

Previous                                                    Next                                                    Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Scala: Hello World project in Eclipse

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×