0

I've simply downloaded an API .jar file of a Coinbase. I've created a project dynamic web project. I added successfully into a reference library that API.

Here is my simple program:

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();
        }
    }
}

As i run this program, it says:

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

Do I need to put something here? I'm did checked thrice, My API key is correct!

  • 1
    This question appears to be off-topic because it is about a generic Java error rather than a Bitcoin related issue, a solution already exists at: stackoverflow.com/questions/17973970/… – George Kimionis Nov 30 '14 at 14:52
  • @GeorgeKimionis I disagree. It would probably be better asked on another site, but I don't think it's offtopic. – Nick ODell Nov 30 '14 at 15:49
  • @GeorgeKimionis However, thanks for finding that link. That could probably be an answer if you quoted one of the answers on that page. – Nick ODell Dec 1 '14 at 15:23
  • @NickODell please be my guest and use that link however you like. – George Kimionis Dec 2 '14 at 0:07
1

Well the problem is that the Coinbase Java Api depends on the Jackson JSON processor, along with several other dependencies that can be found here, and I'm assuming that the jar that you download didn't come with all of these dependencies packaged inside it which means that they won't be on your classpath just because you've added the coinbase jar. You could either try to resolve these dependencies manually, which would be incredibly tedious and unnecessary, or you could use a build automation tool. Considering that the Coinbase Java API was built with it in mind I would recommend setting your project up to use Maven.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.