gpt4 book ai didi

java - cmd中base64编译错误

转载 作者:太空宇宙 更新时间:2023-11-04 06:19:05 24 4
gpt4 key购买 nike

我尝试使用 cmd 编译小程序,但收到以下错误:

Mc.java:1: error: package org.apache.commons.codec.binary does not exist
import org.apache.commons.codec.binary.Base64;
^
Mc.java:279: error: cannot find symbol
byte[] accountKeyBytes = Base64.encodeBase64((accountKey + ":" + accountKey).getBytes());
^
symbol: variable Base64
location: class Mc
2 errors

知道如何解决这个问题吗?

使用 jar 文件编译后,出现错误:

 Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError: org/apach
e/commons/codec/binary/Base64
at Mc.SearchApi(Mc.java:279)
at Mc$ButtonHandler.keyPressed(Mc.java:172)
at java.awt.Component.processKeyEvent(Component.java:6463)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2829)
at java.awt.Component.processEvent(Component.java:6282)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeybo
ardFocusManager.java:899)...

最佳答案

此错误是您的项目中缺少库文件。您只需下载 apache jar 文件并将其设置到您的 java 类路径中即可。

commons-codec-x.x.jar


如果您仍然怀疑是否将 jar 文件设置到类路径中,可以通过以下链接进行查找。

Adding jar to classpath when running from command line
Including jars in classpath on commandline (javac or apt)

关于java - cmd中base64编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27686497/

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