Why do i get a ClassNotFoundException on running a simple scala program on IntelliJ 14+? -
i'm unable figure out wrong program? i'm using older verison of scala (2.7) because compatible libraries i'm using
here simple program i'm attempting run.
the program runs fine using scalac
, scala
commands.
however on intellij 14+ -> when create new project
-> select compiler (scala 2.7)
, try run above program error below
object simpleclass { def main(args: array[string]) { println("this simple class") } }
error output.
why intellij throw classnotfoundexception
? i've saved program simpleclass.scala
/usr/lib/jvm/java-7-openjdk-i386/bin/java -didea.launcher.port=7532 -didea.launcher.bin.path=/home/tejesh/downloads/idea-ic-141.1532.4/bin -dfile.encoding=utf-8 -classpath /usr/lib/jvm/java-7-openjdk-i386/jre/lib/javazic.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/icedtea-sound.jar:/usr/local/share/scala-2.7.3/lib/scala-swing.jar:/usr/local/share/scala-2.7.3/lib/scala-library.jar:/home/tejesh/downloads/idea-ic-141.1532.4/lib/idea_rt.jar com.intellij.rt.execution.application.appmain simpleclass exception in thread "main" java.lang.classnotfoundexception: simpleclass @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:191) @ com.intellij.rt.execution.application.appmain.main(appmain.java:122)
i've added folder containing simpleclass
under sources
recent scala intellij idea based on sbt. apparently scala 2.7.3 not supported longer in configuration. if set project, intellij offer (when select "download" sdk) no version older scala 2.8.0. if manually select 2.7.3, following happens when try compile:
error:scalac: error: org.jetbrains.jps.incremental.scala.remote.serverexception error compiling sbt component 'compiler-interface-2.7.3.final-52.0' @ sbt.compiler.analyzingcompiler$$anonfun$compilesources$1$$anonfun$apply$2.apply(analyzingcompiler.scala:145) @ sbt.compiler.analyzingcompiler$$anonfun$compilesources$1$$anonfun$apply$2.apply(analyzingcompiler.scala:142) @ sbt.io$.withtemporarydirectory(io.scala:285) @ sbt.compiler.analyzingcompiler$$anonfun$compilesources$1.apply(analyzingcompiler.scala:142) @ ...
the next step scala 2.8.2, get:
error:scalac: parameter '-nobootcp' not recognised scalac.
it seems oldest scala works current intellij 2.9.0. (you have use java 7 , not java 8 this!)
the solution downgrade intellij idea old version still supports scala 2.7.3 (perhaps idea 11?), or set project scala 2.9.3, compile instead manually (or using sbt terminal) against 2.7.3.
if have source library requires 2.7.3, perhaps best option try compile library contemporary versions of scala (at least 2.9.0).
Comments
Post a Comment