gpt4 book ai didi

java - 修复 "Configuration cannot be resolved to a type"

转载 作者:行者123 更新时间:2023-12-02 13:29:54 25 4
gpt4 key购买 nike

全部,

我正在尝试 HBase tutorial并使用 Eclipse 作为我的 IDE。以下 1 行代码是问题所在,但我不知道为什么。

Configuration config = HBaseConfiguration.create();

Eclipse 中的错误

Configuration cannot be resolved to a type
  1. 我从 $HBASE_HOME/lib 导入了所有 jar
  2. 我使用的是 HBase 1.2.5

截图 enter image description here

最佳答案

HBase 1.2.5没有Configuration类部分,可以查看其JavaDoc你会发现它不在那里。方法 HBaseConfiguration.create() 返回什么;实际上是 org.apache.hadoop.conf.Configuration 类型,它是 Apache Hadoop Main 的一部分。您还需要将该包导入到您的项目中。

注意

在 Eclipse 中,如果将鼠标悬停在无法解析的类上,它将提供有关可以导入哪些类的建议。如果您没有在那里看到它,那是因为您的类路径中不存在该类。

enter image description here

关于java - 修复 "Configuration cannot be resolved to a type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43232965/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com