java org.apache.commons 无法解析为类型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31981877/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 19:27:26  来源:igfitidea点击:

org.apache.commons cannot be resolved to a type

javapayment-gateway

提问by clover john

I have tried an payment gateway integration. The code given by the gate way have some error

我尝试了支付网关集成。网关给出的代码有一些错误

 byte[] hexBytes = new org.apache.commons.codec.binary.Hex().encode(mac.doFinal(data.getBytes()));

The error is

错误是

org.apache.commons cannot be resolved to a type

org.apache.commons 无法解析为类型

回答by Ben

Do you have Apache Commons Codec in your Classpath?

你的类路径中有 Apache Commons Codec 吗?

If you are using maven, include it with this snippet:

如果您使用的是 maven,请将其包含在以下代码段中:

<dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.10</version>
</dependency>

Or just drop the .jar from hereinto your classpath.

或者只是将.jar 从这里放到你的类路径中。

回答by BernatL

This error could raise wether from not importing:

此错误可能会因不导入而引发:

import org.apache.commons.*; 

Or from not declaring previously any of the variables you are using here.

或者之前没有声明您在此处使用的任何变量。