<p>You need to resolve the dependency <code>org.spongycastle.util.encoders.Hex</code>, more than likely you need to add this dependency to your <code>pom.xml</code> file if you are using Maven. If you are not using maven, you will have download the JAR file from somewhere and I add it to your build path in Eclipse. </p>

<p>From a quick Google search this appears <a href="http://grepcode.com/snapshot/repo1.maven.org/maven2/com.madgag/sc-light-jdk15on/1.47.0.3/" rel="nofollow">this</a> is  the dependency that you want. </p>

CC BY-SA 3.0
2014-10-31T17:42:12.223Z
Thanks! The link is what I was looking for. In order to get it working, I downloaded the following dependencies: **sc-light-jdk15on-1.47.0.3.jar, slf4j-simple-1.7.7.jar, slf4j-api-1.7.7.jar, guava-18.0.jar**.
Ashley
CC BY-SA 3.0
2014-10-31T12:26:34.240Z
2014-10-31T12:26:34.240Z
Chris Stewart
<p>I have a private key bigInt of type bigInteger and I would like to generate the address corresponding to this private key. I implemented the following function</p>

<pre><code>public String get_address () {
Address address = new Address(NetworkParameters.prodNet(), Utils.sha256hash160(new ECKey(bigInt).getPubKey()));
return address.toString();
}
</code></pre>

<p>When compiling, I have</p>

<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/spongycastle/util/encoders/Hex
at com.google.bitcoin.core.NetworkParameters.&lt;clinit&gt;(NetworkParameters.java:49)
at bitcoin.get_address(bitcoin.java:40)
at main.main(main.java:11)
Caused by: java.lang.ClassNotFoundException: org.spongycastle.util.encoders.Hex
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
</code></pre>

<p>I guess that I need to import the library org.spongycastle but I don't know how to do that in Eclipse.</p>

<p>Who can help me with this?</p>

<p>Thanks a lot.</p>

<address><java>
java.lang.NoClassDefFoundError: org/spongycastle/util/encoders/Hex in Java when dealing with Bitcoin addresses
Ashley
# java.lang.NoClassDefFoundError: org/spongycastle/util/encoders/Hex in Java when dealing with Bitcoin addresses

(Asked by: username_0 on 2014-10-31)

I have a private key bigInt of type bigInteger and I would like to generate the address corresponding to this private key. I implemented the following function
public String get_address () {
Address address = new Address(NetworkParameters.prodNet(), Utils.sha256hash160(new ECKey(bigInt).getPubKey()));
return address.toString();
}

When compiling, I have
Exception in thread "main" java.lang.NoClassDefFoundError: org/spongycastle/util/encoders/Hex
at com.google.bitcoin.core.NetworkParameters.(NetworkParameters.java:49)
at bitcoin.get_address(bitcoin.java:40)
at main.main(main.java:11)
Caused by: java.lang.ClassNotFoundException: org.spongycastle.util.encoders.Hex
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more

I guess that I need to import the library org.spongycastle but I don't know how to do that in Eclipse.
Who can help me with this?
Thanks a lot.

**Tags:** address, java


---

## 1 answers

### Answer by username_1 on 2014-10-31. Score: 1 | Accepted answer

You need to resolve the dependency `org.spongycastle.util.encoders.Hex`, more than likely you need to add this dependency to your `pom.xml` file if you are using Maven. If you are not using maven, you will have download the JAR file from somewhere and I add it to your build path in Eclipse.

From a quick Google search this appears [this](http://grepcode.com/snapshot/repo1.maven.org/maven2/com.madgag/sc-light-jdk15on/1.47.0.3/) is the dependency that you want.

> **Comments:**
> **username_0**: Thanks! The link is what I was looking for. In order to get it working, I downloaded the following dependencies: **sc-light-jdk15on-1.47.0.3.jar, slf4j-simple-1.7.7.jar, slf4j-api-1.7.7.jar, guava-18.0.jar**.  

---

