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流 –