我只是下载了一个 API.jar
文件Coinbase
。我创建了一个项目dynamic web project
。我成功地将该 API 添加到参考库中。
这是我的简单程序:
import com.coinbase.api.Coinbase;
import com.coinbase.api.CoinbaseBuilder;
public class Main {
public static void main(String[] args){
try {
Coinbase cb=new CoinbaseBuilder()
.withApiKey(System.getenv("My API KEY"), System.getenv("MY API SECRET"))
.build();
} catch (Exception e) {
e.printStackTrace();
}
}
}
当我运行这个程序时,它说:
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/type/TypeReference
at com.coinbase.api.CoinbaseBuilder.build(CoinbaseBuilder.java:16)
at Main.main(Main.java:11)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.type.TypeReference
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
我需要在这里放点东西吗?我检查了三次:我的 API 密钥是正确的。