scala 奇怪的错误信息:错误的符号引用。package.class 中的签名指的是 package org 中不可用的术语 apache
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14336834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
strange error message: bad symbolic reference. A signature in package.class refers to term apache in package org which is not available
提问by xhudik
When I tried to compile simple typesafe' akka program (scala 2.10, akka, 2.1.0):
当我尝试编译简单类型安全的 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
The code on line 21:
第 21 行的代码:
val mina = system.actorOf(Props[MyEndPoint])
(The same program was compiled correctly in Eclipse, so the source code is OK)
(同样的程序在Eclipse中编译正确,所以源码没问题)
Most likely some jar file is missing in -cp variable. The question is what mean that strange/useless error message.
很可能 -cp 变量中缺少某些 jar 文件。问题是奇怪/无用的错误消息是什么意思。
Thanks, Tomas
谢谢,托马斯
采纳答案by Iulian Dragos
The message says "There's no package org.apachein my classpath, and I need it while reading file package.class". Pass -Ylog-classpathto scalacand look at what is the realclasspath that gets to the compiler.
消息说“org.apache我的类路径中没有包,我在读取文件时需要它package.class”。通过-Ylog-classpath对scalac,看看什么是真正的类路径获取到编译器。
回答by mancvso
To me it was JDK not set on PATH neither JAVA_HOME
对我来说,JDK 没有设置在 PATH 上,也没有 JAVA_HOME
You can add JAVA_HOME to point to your JDK root folder and add jdk/bin folder (wich inludes javac) directly to the path.
您可以添加 JAVA_HOME 以指向您的 JDK 根文件夹,并将 jdk/bin 文件夹(包括 javac)直接添加到路径中。
You can refer to the Oracle docs for instruccions on how to add the path http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html
您可以参考 Oracle 文档了解如何添加路径 http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html
回答by Sherms
In case this helps anyone in the future, I was having this problem with an application I adopted after adding a new class. It turned out that the capitalization in the package name in each class within the package and the actual directory structure were different. Once I lower-cased all of the directory it started working again.
如果这对将来的任何人有帮助,我在添加新类后采用的应用程序遇到了这个问题。原来是包内每个类的包名大小写和实际目录结构不同。一旦我将所有目录小写,它就会再次开始工作。
回答by idan koch
First time Scala user. I had some problems in configuring my eclipse and I used to get:
第一次 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.
Finally found that scala test version 2.11 and compiler version should match. Downloaded scala version 2.11-RC1
最后发现scala test version 2.11和compiler version应该匹配。下载 Scala 版本 2.11-RC1

