465552 (1) [Avatar] Offline
#1
Hi, I'm having a little difficulty getting the very first code sample HelloWorld.scala. My setup looks like:


  • /figaro-4.1.0.0/fat-jar/figaro_2.11-4.1.0.0-fat.jar
    /scala-library/jars/scala-library-2.11.4.jar
    Java 1.8.0-openjdk-amd64


  • /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -javaagent:/home/toast/Downloads/idea-IC-171.4073.35/lib/idea_rt.jar=40635:/home/toast/Downloads/idea-IC-171.4073.35/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/rt.jar:/home/toast/IdeaProjects/helloWorld/target/scala-2.11/classes:/home/toast/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.4.jar:/home/toast/figaro-4.1.0.0/fat-jar/figaro_2.11-4.1.0.0-fat.jar HelloWorld
    Exception in thread "main" java.lang.NoClassDefFoundError: scala/reflect/runtime/package$
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.makeResultFactor(VariableElimination.scala:238)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.finish(VariableElimination.scala:242)
    	at com.cra.figaro.algorithm.factored.VariableElimination$$anonfun$doElimination$1.apply$mcV$sp(VariableElimination.scala:175)
    	at com.cra.figaro.algorithm.factored.VariableElimination$$anonfun$doElimination$1.apply(VariableElimination.scala:175)
    	at com.cra.figaro.algorithm.factored.VariableElimination$$anonfun$doElimination$1.apply(VariableElimination.scala:175)
    	at com.cra.figaro.algorithm.factored.VariableElimination$class.optionallyShowTiming(VariableElimination.scala:63)
    	at com.cra.figaro.algorithm.factored.VariableElimination$class.doElimination(VariableElimination.scala:175)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.doElimination(VariableElimination.scala:213)
    	at com.cra.figaro.algorithm.factored.VariableElimination$class.ve(VariableElimination.scala:160)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.ve(VariableElimination.scala:213)
    	at com.cra.figaro.algorithm.factored.VariableElimination$class.run(VariableElimination.scala:186)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.run(VariableElimination.scala:213)
    	at com.cra.figaro.algorithm.OneTime$class.doStart(OneTime.scala:28)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.doStart(VariableElimination.scala:213)
    	at com.cra.figaro.algorithm.Algorithm$class.start(Algorithm.scala:83)
    	at com.cra.figaro.algorithm.factored.ProbQueryVariableElimination.start(VariableElimination.scala:213)
    	at com.cra.figaro.algorithm.factored.VariableElimination$.probability(VariableElimination.scala:359)
    	at com.cra.figaro.algorithm.factored.VariableElimination$.probability(VariableElimination.scala:369)
    	at HelloWorld$.predict(helloWorld1.scala:16)
    	at HelloWorld$.main(helloWorld1.scala:37)
    	at HelloWorld.main(helloWorld1.scala)
    Caused by: java.lang.ClassNotFoundException: scala.reflect.runtime.package$
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 21 more


    This happens with the .scala file that i downloaded from here

    I don't have any experience with java or scala so apologies in advance if this is something obvious or i have left out some additional info.

    Thanks
    mxr (3) [Avatar] Offline
    #2
    I recommend you download and install Simple Build Tool (http://www.scala-sbt.org) and the FigaroWork SBT project (http://www.cra.com/figaro) and work from the command line/terminal to get started.

    Once you have SBT and FigaroWork installed, you can create your Figaro test files in the

    \FigaroWork\src\main\scala

    directory and then compile and run them by using the command

    sbt run

    Doing things this way helps to shield you from certain complexities such as properly setting the Scala classpath.