16

当我尝试编译简单的类型安全的 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 文件。问题是奇怪/无用的错误消息是什么意思。

谢谢,托马斯

4

4 回答 4

11

消息说“我的类路径中没有包org.apache,我在读取文件时需要它package.class”。传递-Ylog-classpathscalac并查看到达编译器的真正类路径是什么。

于 2013-01-15T21:15:51.957 回答
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

于 2013-09-10T14:50:35.447 回答
1

万一这对将来的任何人有帮助,我在添加新课程后采用的应用程序遇到了这个问题。原来包内每个类的包名大小写和实际的目录结构都不一样。一旦我将所有目录都小写,它就会再次开始工作。

于 2019-02-06T22:13:10.683 回答
0

第一次使用 Scala 用户。我在配置我的eclipse时遇到了一些问题,我曾经得到:

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

于 2014-08-28T13:58:18.370 回答