The pom.xml File
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.mystuff</groupId> <artifactId>rx</artifactId> <version>1.0.0</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>io.reactivex.rxjava2</groupId> <artifactId>rxjava</artifactId> <version>2.1.7</version> </dependency> </dependencies> </project>
The Command To Process the pom.xml File
$ mvn dependency:copy-dependencies -DoutputDirectory=lib
This results in downloading rxjava-2.1.7.jar and its dependency, reactive-streams-1.0.1.jar into the lib folder.
Let's Use These Jars in JShell
$ jenv local 9.0 $ jshell --class-path lib/reactive-streams-1.0.1.jar:lib/rxjava-2.1.7.jar | Welcome to JShell -- Version 9.0.1 | For an introduction type: /help intro jshell> import io.reactivex.*; jshell> public class HelloWorld { ...> public static void main(String[] args) { ...> Flowable.just("Hello World").subscribe(System.out::println); ...> } ...> } | created class HelloWorld jshell> String[] emptyArray = new String[0]; emptyArray ==> String[0] { } jshell> HelloWorld.main(emptyArray); Hello World jshell> import io.reactivex.functions.Consumer; jshell> Flowable.just("Hello World"). ...> subscribe(new Consumer() { ...> @Override public void accept(String s) { ...> System.out.println(s); ...> } ...> }); Hello World $6 ==> CANCELLED jshell>