
Observables
- RxJava - How Observable works
- RxJava - Creating Observables
- RxJava - Using Flowable
- RxJava - Using Observable
- RxJava - Single Observable
- RxJava - Maybe Observable
- RxJava - Completable Observable
- RxJava - Using CompositeDisposable
Operators
- RxJava - Creating Operators
- RxJava - Transforming Operators
- RxJava - Filtering Operators
- RxJava - Combining Operators
- RxJava - Utility Operators
- RxJava - Conditional Operators
- RxJava - Mathematical Operators
- RxJava - Connectable Operators
Subjects
- RxJava - Subjects
- RxJava - PublishSubject
- RxJava - BehaviorSubject
- RxJava - ReplaySubject
- RxJava - AsyncSubject
- RxJava - UnicastSubject
Schedulers
- RxJava - Schedulers
- RxJava - Trampoline Scheduler
- RxJava - NewThread Scheduler
- RxJava - Computation Scheduler
- RxJava - IO Scheduler
- RxJava - From Scheduler
Miscellaneous
RxJava Useful Resources
RxJava - Environment Setup
This chapter will guide you on how to prepare a development environment to start your work with RxJava. It will also teach you how to set up JDK on your machine before you set up RxJava −
Setup Java Development Kit (JDK)
You can download the latest version of SDK from Oracle's Java site − Java SE Downloads. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively.
If you are running Windows and have installed the JDK in C:\jdk-24, you would have to put the following line in your C:\autoexec.bat file.
set PATH=C:\jdk-24;%PATH% set JAVA_HOME=C:\jdk-24
Alternatively, on Windows NT/2000/XP, you will have to right-click on My Computer, select Properties → Advanced → Environment Variables. Then, you will have to update the PATH value and click the OK button.
On Unix (Solaris, Linux, etc.), if the SDK is installed in /usr/local/jdk-24 and you use the C shell, you will have to put the following into your .cshrc file.
setenv PATH /usr/local/jdk-24/bin:$PATH setenv JAVA_HOME /usr/local/jdk-24
Alternatively, if you use an Integrated Development Environment (IDE) like Borland JBuilder, Eclipse, IntelliJ IDEA, or Sun ONE Studio, you will have to compile and run a simple program to confirm that the IDE knows where you have installed Java. Otherwise, you will have to carry out a proper setup as given in the document of the IDE.
Popular Java Editors
To write your Java programs, you need a text editor. There are many sophisticated IDEs available in the market. But for now, you can consider one of the following −
Notepad − On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.
Netbeans − It is a Java IDE that is open-source and free, which can be downloaded from www.netbeans.org/index.html.
Eclipse − It is also a Java IDE developed by the eclipse open-source community and can be downloaded from www.eclipse.org.
Download RxJava Archive
Download the latest version of RxJava jar files. At the time of writing this tutorial, we have downloaded rxjava-3.1.11.jar and reactive-streams-1.0.4.jar, and copied it into C:\>RxJava folder.
OS | Archive name |
---|---|
Windows | rxjava-3.1.11.jar;reactive-streams-1.0.4.jar |
Linux | rxjava-3.1.11.jar;reactive-streams-1.0.4.jar |
Mac | rxjava-3.1.11.jar;reactive-streams-1.0.4.jar |
Set RxJava Environment
Set the RxJava environment variable to point to the base directory location where rxjava jar is stored on your machine. Let's assuming we've stored rxjava-3.1.11.jar in the RxJava folder.
Sr.No | OS & Description |
---|---|
1 |
Windows Set the environment variable RxJava to C:\RxJava |
2 |
Linux export RxJava = /usr/local/RxJava |
3 |
Mac export RxJava = /Library/RxJava |
Set CLASSPATH Variable
Set the CLASSPATH environment variable to point to the rxjava jar location.
Sr.No | OS & Description |
---|---|
1 |
Windows Set the environment variable CLASSPATH to %CLASSPATH%;%RxJava%\rxjava-3.1.11.jar:%RxJava%\reactive-streams-1.0.4.jar;.; |
2 |
Linux export CLASSPATH = $CLASSPATH:$RxJava/rxjava-3.1.11.jar:$RxJava/reactive-streams-1.0.4.jar:. |
3 |
Mac export CLASSPATH = $CLASSPATH:$RxJava/rxjava-3.1.11.jar:$RxJava/reactive-streams-1.0.4.jar:. |