このプロジェクトhttps://github.com/timmolter/XChangeから jar ファイルをダウンロードしました。現在、Eclipse で実行されているサンプル プログラムを取得しようとしています。
実行前にエラーは表示されませんが、実行しようとすると次のエラー メッセージが表示されます。
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.xeiam.xchange.ExchangeFactory.<init>(ExchangeFactory.java:41)
at com.xeiam.xchange.ExchangeFactory.<clinit>(ExchangeFactory.java:39)
at com.xeiam.xchange.rhbotha.bot.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
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)
... 3 more
これは私のコードです。
package com.xeiam.xchange.rhbotha.bot;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.currency.Currencies;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.mtgox.v1.MtGoxExchange;
import com.xeiam.xchange.service.marketdata.polling.PollingMarketDataService;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// Use the factory to get the version 1 MtGox exchange API using default settings
Exchange mtGoxExchange = ExchangeFactory.INSTANCE.createExchange(MtGoxExchange.class.getName());
// Interested in the public polling market data feed (no authentication)
PollingMarketDataService marketDataService = mtGoxExchange.getPollingMarketDataService();
// Get the latest ticker data showing BTC to USD
Ticker ticker = marketDataService.getTicker(Currencies.BTC, Currencies.USD);
System.out.println(ticker.toString());
// Get the latest ticker data showing BTC to EUR
ticker = marketDataService.getTicker(Currencies.BTC, Currencies.EUR);
System.out.println(ticker.toString());
// Get the latest ticker data showing BTC to GBP
ticker = marketDataService.getTicker(Currencies.BTC, Currencies.GBP);
System.out.println(ticker.toString());
}
}
私が読んだことから、クラスパスの問題である可能性がありますが、どうすればよいかわかりません。どんな助けでも大歓迎です。