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 8595447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:26:07+00:00 2026-06-12T00:26:07+00:00

Code: object HelloWorld{ def main(args: Array[String]){ println(Hello, world!) } } Environment Variables: On windows:

  • 0

Code:

object HelloWorld{
    def main(args: Array[String]){
        println("Hello, world!")
    }
}

Environment Variables:

On windows:

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_07
CLASSPATH = .;C:\Program Files\Java\jdk1.7.0_07\lib;C:\Software\scala-2.9.2\lib
PATH = %PATH%;C:\Program Files\Java\jdk1.7.0_07\bin;C:\Software\scala-2.9.2\bin
SCALA_HOME = C:\Software\scala-2.9.2

Steps:

scala HelloWorld.scala  //Correctly output Hello,world!
scalac HelloWorld.scala //No Compilation error
java HelloWorld  //Errors shown below

Error:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at HelloWorld.main(HelloWorld.scala)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more

Sorry for the noobie question, but I have tried for a long time and could not get it work.

Tried scala -save to jar file and run java -jar; also tried change classpath like adding scala-library.jar, and still not working.

  • 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-12T00:26:09+00:00Added an answer on June 12, 2026 at 12:26 am

    This works for me (Linux):

    java -cp scala-library-2.9.1.jar:. HelloWorld
    

    scala-library-2.9.1.jar can be found here.

    On Windows you have to use semicolon as CLASSPATH separator:

    java -cp scala-library-2.9.1.jar;. HelloWorld
    

    Basically you need to add both scala-library-*.jar JAR and .class files with your code. In the examples above is simply use . to denote .class files in current directory.

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

Sidebar

Related Questions

Let's say I have this Hello.scala. object HelloWorld { def main(args: Array[String]) { println(Hello,
import org.apache.tools.ant.Project object HelloWorld { def main(args: Array[String]) { println(Hello, world!) } } I
This program, after executing main(), does not exit. object Main { def main(args: Array[String])
The code: object Link { //TYPE-1 (purely functional) def apply(name: String, target: Page, f:
I am receiving an error on the following line of code: Object reference not
Dummy code: public object Addition(object a, object b) { var type = a.GetType(); var
I have the following code (changed object names, so syntax/spelling errors ignore). public class
I'm inside a shared object (code) loaded with dlopen. I want to know the
I have a list of a object Code: List<Code> listCodes = new List<Code>(); I
using jquery's .post i send do my php code an object that with var_dump

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.