Stream.java爲什麼我得到NoClassDefFoundError的:組織/ reactivestreams /發行商
import io.reactivex.*;
public class Stream {
public static void main(String args[])
{
Observable.just("Howdy!").subscribe(System.out::println);
}
}
的build.gradle:
group 'com.sakhunzai'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
compile 'io.reactivex.rxjava2:rxjava:2.0.5'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
例外:
Exception in thread "main" java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
....
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
我下面的tutorial在第六頁,除了我決定使用gradle而不是maven
編輯
也許有些問題與gradle這個和IntelliJ IDEA的
下列固定的問題: settings.gradle:
rootProject.name = 'JavaRx'
include "buildSrc"
我想你應該添加依賴於org.reactivestreams.reactive流 –