i'm a scala newbee. i have one question. in my code ,i try to import httpparse library like this
scalac -classpath /home/kula/code/201005/kookle/lib/htmlparser.jar crawler.scala
and i run this code.
scala main
and it tell me that
java.lang.NoClassDefFoundError: org/htmlparser/Parser
at FetchActor$$anonfun$act$1$$anonfun$apply$1.apply(crawler.scala:21) at FetchActor$$anonfun$act$1$$anonfun$apply$1.apply(crawler.scala:13) at scala.actors.Reaction.run(Reaction.scala:78) at scala.actors.FJTask$Wrap.run(Unknown Source) at scala.actors.FJTaskRunner.scanWhileIdling(Unknown Source) at scala.actors.FJTaskRunner.run(Unknown Source)
i check the file./home/kula/code/201005/kookle/lib/htmlparser.jar and it is no problem.anyone can tell me h开发者_如何学编程ow cause this bug?
try
scala -classpath /home/kula/code/201005/kookle/lib/htmlparser.jar crawler.scala
i.e. also run it with the required jars on the classpath
Arjan's answer should work. However, I would recommend just using sbt and let it figure out all of this stuff for you.
精彩评论