This Question should not be closed as suggested answer does not answer question in this case.
The below code causes this error :
Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at scala.java.mixed.test.Driver.main(Driver.java:17)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 13 more
The code :
package parallel
import com.recommendations.EucleudianProperties
class TestData(var distanceMap : java.util.Map[java.lang.String , java.lang.String]) {
object ProcessData{
def apply {
println("in apply method "+distanceMap.size)
}
}
}
package scala.java.mixed.test;
import java.util.HashMap;
import java.util.Map;
import parallel.TestData;
public class Driver {
public static void main(String args[]){
Map<String , String> distanceMap = new HashMap<String , String>();
new TestData(distanceMap);
}
}
What is causing this error ? Am I calling the Scala class TestData from java class Driver correctly ?
EDIT : here is the build path