当我尝试编译简单类型安全'akka程序(scala 2.10,akka,2.1.0)时:
scalac -cp "akka-actor_2.10-2.1.0.jar:akka-camel_2.10-2.1.0.jar" write2.scala
error: bad symbolic reference. A signature in package.class refers to term apache
in package org which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling package.class.
error: bad symbolic reference. A signature in package.class refers to term camel
in value org.apache which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling package.class.
write2.scala:21: error: bad symbolic reference. A signature in package.class refers to term model
in value org.camel which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling package.class.
val mina = system.actorOf(Props[MyEndPoint])
three errors found
第21行的代码:
val mina = system.actorOf(Props[MyEndPoint])
(在Eclipse中正确编译了相同的程序,所以源代码没问题)
很可能在-cp变量中缺少一些jar文件。问题是这个奇怪/无用的错误消息是什么意思。
谢谢,托马斯
答案 0 :(得分:11)
消息说“我的类路径中没有包org.apache
,我在阅读文件package.class
时需要它”。将-Ylog-classpath
传递给scalac
并查看获取编译器的真实类路径。
答案 1 :(得分:2)
对我而言,JDK没有在PATH上设置JAVA_HOME
您可以添加JAVA_HOME指向您的JDK根文件夹,并将jdk / bin文件夹(包括javac)直接添加到路径中。
您可以参考Oracle文档获取有关如何添加路径的说明 http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html
答案 2 :(得分:1)
以防万一将来对任何人有帮助,我在添加新类后所采用的应用程序遇到了这个问题。事实证明,包中每个类的包名称中的大写字母与实际目录结构不同。小写所有目录后,它又开始工作。
答案 3 :(得分:0)
第一次使用Scala用户。我在配置我的日食方面遇到了一些问题,我曾经得到过:
Error:scalac: bad symbolic reference. A signature in package.class refers to type compileTimeOnly
in package scala.annotation which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling package.class.
最后发现scala测试版本2.11和编译器版本应该匹配。 下载的scala版本2.11-RC1