Bitcoin Forum

Bitcoin => Wallet software => Topic started by: alkor on May 03, 2011, 09:19:40 PM



Title: Testing bitcoinj on Ubuntu
Post by: alkor on May 03, 2011, 09:19:40 PM
I am trying to test bitcoinj on Ubuntu, but I am having some trouble. I am not experienced with Java delvelopment, so maybe I am missing something obvious

Here are the steps I follow to build bitcoinj
Code:
sudo apt-get install libslf4j-java
svn checkout http://bitcoinj.googlecode.com/svn/trunk/ bitcoinj
cd bitcoinj
ant

The last command results in the following error:

Code:
Buildfile: ~/Desktop/Dev/bitcoinj/build.xml

init:

compile:
    [javac] Compiling 814 source files to ~/Desktop/Dev/bitcoinj/out
    [javac] ~/Desktop/Dev/bitcoinj/src/com/google/bitcoin/core/Block.java:25: package org.slf4j does not exist
    [javac] import org.slf4j.Logger;
    [javac]                 ^
    [javac] ~/Desktop/Dev/bitcoinj/src/com/google/bitcoin/core/Block.java:26: package org.slf4j does not exist
    [javac] import org.slf4j.LoggerFactory;
    [javac]                 ^

How can I get it to find the slf4j package?

Thanks.


Title: Re: Testing bitcoinj on Ubuntu
Post by: just_someguy on May 03, 2011, 10:38:39 PM
Open build.xml and change this:
<classpath path="lib/junit-4.8.2.jar"/>
to this:
<classpath path="lib/junit-4.8.2.jar"/>
       <classpath path="lib/sl4j-api-1.6.1.jar"/>
       <classpath path="lib/sl4j-simple-1.6.1.jar"/>

That should probably do it.
slf4j is a recent addition and just didn't get added to the build script.


Title: Re: Testing bitcoinj on Ubuntu
Post by: Mike Hearn on May 04, 2011, 11:58:03 AM
Whoops, fixed. Updating to svn head should resolve things. You don't need to install it from apt - the source tree is self contained.

The best place to ask questions about bitcoinj is the mailing list. Did you know there was one? Maybe I need to make it more visible.


Title: Re: Testing bitcoinj on Ubuntu
Post by: alkor on May 04, 2011, 03:28:55 PM
Whoops, fixed. Updating to svn head should resolve things. You don't need to install it from apt - the source tree is self contained.

The best place to ask questions about bitcoinj is the mailing list. Did you know there was one? Maybe I need to make it more visible.

Thanks. It's working now.


Title: Re: Testing bitcoinj on Ubuntu
Post by: alkor on May 04, 2011, 09:58:29 PM
Now, I am getting a different error. Following the instructions in the README after completing the build:

Code:
$ cd out
$ java com.google.bitcoin.examples.PingService
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.google.bitcoin.core.Block.<clinit>(Unknown Source)
at com.google.bitcoin.core.NetworkParameters.createGenesis(Unknown Source)
at com.google.bitcoin.core.NetworkParameters.prodNet(Unknown Source)
at com.google.bitcoin.examples.PingService.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 4 more


Title: Re: Testing bitcoinj on Ubuntu
Post by: just_someguy on May 04, 2011, 11:10:57 PM
Try running it like this:
Code:
java -classpath .:../lib/* com.google.bitcoin.examples.PingService

In the mean time file an issue report at the bitcoinj project so the build can get fixed to include the logger.