0

I'm using stanford's topic modelling toolkit

This is a simple scala program running on eclipse

Why do i keep getting this error Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class

import scalanlp.io._;

object Main {
  def main(args: Array[String]) {

    println("added value"+c);

    val pubmed = CSVFile("pubmed-oa-subset.csv");

    println("Success: " + pubmed.data.size + " records");


  }
}

Full error here

Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at scalanlp.io.CSVFile$.CSVFileAsParcel(CSVFile.scala:73)
    at Main$.main(t1.scala:27)
    at Main.main(t1.scala)
wolfgang
  • 7,281
  • 12
  • 44
  • 72

1 Answers1

1

The code supplied is correct... The problem is (most probably) a Scala version problem. The jar is compiled with Scala 2.8 (5 years ago), as quote from http://nlp.stanford.edu/software/tmt/tmt-0.4/:

TMT was written during 2009-10 in what is now a quite old version of Scala, using a linear algebra library that is also no longer developed. Some people still use it and find it a friendly piece of software for LDA and Labeled LDA models, and more power to you, but at this point we really can't offer any support or fix any problems. Sorry about that.

The IncompatibleClassChangeError as described here What causes java.lang.IncompatibleClassChangeError?, is due to a binary incompatibility. So the only option is to install an old version of Scala, preferable 2.8.0.

Community
  • 1
  • 1
Danielson
  • 2,605
  • 2
  • 28
  • 51
  • Thanks for looking into it Danielson, This is the modified program with the output http://pastebin.com/P40rgVEa – wolfgang Jul 23 '15 at 13:42
  • @Danierlson I'm running the latest Java SE7 Do you have any other ideas why i'm finding this error? library: http://nlp.stanford.edu/software/tmt/tmt-0.4/tmt-0.4.0.jar dataset http://nlp.stanford.edu/software/tmt/tmt-0.4/examples/pubmed-oa-subset.csv source code -> same as question – wolfgang Jul 23 '15 at 14:25
  • 1
    No, you didn't do anything wrong... I'm questioning Scala version... Since the project has been abandoned since 2010 (`TMT was written during 2009-10 in what is now a quite old version of Scala` from http://nlp.stanford.edu/software/tmt/tmt-0.4/) , a lot of things have been happened (without backwards compatibility support, which is why I returned to Java). I know some major stuff happened between 2.8.0 and 2.10... (I can't install Scala < 2.10 in Scala IDE...) – Danielson Jul 23 '15 at 15:12