Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8101793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:04:28+00:00 2026-06-05T23:04:28+00:00

I am reading Martin Odersky’s Programming in Scala , and I have been using

  • 0

I am reading Martin Odersky’s Programming in Scala, and I have been using vi and the command line to compile so far. I want to learn to use Eclipse and the Scala-IDE plug-in, but I lack a basic understanding of compiling and executing multiple source code files in Eclipse.

My IDE is as follows:

  • Ubuntu 12.04
  • Eclipse 3.7.2
  • Scala Plugin 2.0.1
  • Scala Library 2.9.2

I am using the Checksum example in Chapter 4 for practice. The source code is as follows:

Listings 4.1 & 4.2 / ChecksumAccumulator.scala:

class ChecksumAccumulator {
    private var sum = 0
    def add(b: Byte) { sum += b }
    def checksum(): Int = ~(sum & 0xFF) + 1
}

import scala.collection.mutable.Map

object ChecksumAccumulator {

    private val cache = Map[String, Int]()

    def calculate(s: String): Int = 
        if (cache.contains(s))
            cache(s)
        else {
            val acc = new ChecksumAccumulator
            for (c <- s)
                acc.add(c.toByte)
            val cs = acc.checksum()
            cache += (s -> cs)
            cs
        }
}  

Listing 4.3 / Summer.scala:

import ChecksumAccumulator.calculate

object Summer {
    def main(args: Array[String]) {
        for (arg <- args)
            println(arg + ": " + calculate(arg))
    }
}

I can compile these classes using scalac Summer.scala ChecksumAccumulator.scala at the command line. I can then execute the object code with the command line scala Summer of love, which returns the checksum results for “of” and “love” (-213 and -182, respectively).

How would I build the object code using Eclipse and not the command line, and how would I call the Summer object code through Eclipse?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:04:30+00:00Added an answer on June 5, 2026 at 11:04 pm

    In Eclipse, you can just create a new Scala project, and put the source files there.
    Once the files are part of the same project, there’s no need to do anything special:

    Just click on Run >> Run As >> Scala Application (or press Alt + Shift + X, S)

    Have fun learning Scala 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading Rafactoring by Martin Fowler and in the beginning of the
After reading Martin Fowler's Mocks Aren't Stubs , I've discovered I've been practicing TDD
Thanks for reading this. I have markup similar to what is below. Using the
I have been reading to stay away from JavaScript for a lot of things,
Reading the Scala by Example book and there is this example when Martin explains
I'm reading Bob Martin's principles of OOD, specifically the SRP text , and I
I'm reading Martin Fowler's Book about enterprise application architecture design patterns, but the German
I was reading about DSLs (Martin Fowler's book) and in the first chapter he
I was reading an article put together by Martin Fowler regarding Composed Regular Expressions
I am just reading Agile Principles, Patterns and Practices in C# by R. Martin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.