所以我一直在尝试使用signal-collect框架,我下载了.jar
文件并将其解压缩到一个文件夹中。目前,该文件夹结构是这样的:将.jar添加到类路径(Scala)
LICENSE.txt
PageRank.scala
core-1.1.1-sources.jar
dependencies/
javaapi-1.1.1-sources.jar
NOTICE.txt
README.txt
core-1.1.1.jar
javaapi-1.1.1-javadoc.jar
javaapi-1.1.1.jar
哪里PageRank.scala
是Scala的测试代码他们提供的,这就是:
import com.signalcollect._
object PageRank extends App {
val graph = GraphBuilder.build
graph.addVertex(new PageRankVertex(id=1))
graph.addVertex(new PageRankVertex(id=2))
graph.addEdge(new PageRankEdge(sourceId=1, targetId=2))
graph.addEdge(new PageRankEdge(sourceId=2, targetId=1))
graph.execute
graph.foreachVertex(println(_))
graph.shutdown
}
class PageRankVertex(id: Any, dampingFactor: Double=0.85)
extends DataGraphVertex(id=id, state=1-dampingFactor) {
type Signal = Double
def collect(oldState: Double, mostRecentSignals: Iterable[Double]): Double = {
1 - dampingFactor + dampingFactor * mostRecentSignals.sum
}
}
class PageRankEdge(sourceId: Any, targetId: Any)
extends DefaultEdge(sourceId, targetId) {
type SourceVertex = PageRankVertex
def signal(sourceVertex: PageRankVertex) = {
sourceVertex.state * weight/sourceVertex.sumOfOutWeights
}
}
我是一个新手,当涉及到JVM /的Java/Scala和这是我在加入.jar's
到classpath编译PageRank.scala
尝试:
$ scalac -classpath *.jar dependencies/*.jar PageRank.scala
error: IO error while decoding core-1.1.1.jar with UTF-8
Please try specifying another one using the -encoding option
error: IO error while decoding javaapi-1.1.1-javadoc.jar with UTF-8
Please try specifying another one using the -encoding option
error: IO error while decoding javaapi-1.1.1-sources.jar with UTF-8
Please try specifying another one using the -encoding option
error: IO error while decoding javaapi-1.1.1.jar with UTF-8
Please try specifying another one using the -encoding option
error: IO error while decoding dependencies/je-3.2.76.jar with UTF-8
Please try specifying another one using the -encoding option
error: IO error while decoding dependencies/scala-library-2.9.1.jar with UTF-8
Please try specifying another one using the -encoding option
6 errors found
我想不出什么错误......什么之H appening? 谢谢! Regards, -kstruct
你也可以用';'分离罐名 – Jus12 2012-04-10 06:48:24
+1为了完成起见,需要注意的是,在编译和执行**时,都必须添加类路径。这是我乍一看错过的东西。 – JoErNanO 2015-11-18 12:50:18