Stream.java
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:
Exception in thread "main" java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
....
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
I am following the tutorial at page six, except I decided to use gradle instead of maven
Edit
Probably some issue with gradle and Intellij IDEA
Following fixed the issue: settings.gradle:
rootProject.name = 'JavaRx'
include "buildSrc"