Bitcoin Forum
May 04, 2024, 02:28:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Testing bitcoinj on Ubuntu  (Read 3734 times)
alkor (OP)
Full Member
***
Offline Offline

Activity: 136
Merit: 100


View Profile
May 03, 2011, 09:19:40 PM
 #1

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.
1714789692
Hero Member
*
Offline Offline

Posts: 1714789692

View Profile Personal Message (Offline)

Ignore
1714789692
Reply with quote  #2

1714789692
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714789692
Hero Member
*
Offline Offline

Posts: 1714789692

View Profile Personal Message (Offline)

Ignore
1714789692
Reply with quote  #2

1714789692
Report to moderator
just_someguy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 03, 2011, 10:38:39 PM
 #2

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.
Mike Hearn
Legendary
*
Offline Offline

Activity: 1526
Merit: 1129


View Profile
May 04, 2011, 11:58:03 AM
 #3

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.
alkor (OP)
Full Member
***
Offline Offline

Activity: 136
Merit: 100


View Profile
May 04, 2011, 03:28:55 PM
 #4

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.
alkor (OP)
Full Member
***
Offline Offline

Activity: 136
Merit: 100


View Profile
May 04, 2011, 09:58:29 PM
 #5

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
just_someguy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 04, 2011, 11:10:57 PM
 #6

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!