To use Rserve to call R functions from Java, follow these steps:
- Start the Rserve server to accept client connections:
> Rserve(args="--no-save") - On Mac and Linux > Rserve() - on windows Rserv started in daemon mode.
- Execute the Java program to draw ggplot in R and display the image. Change the argument to the call to reflect your R working directory where the auto-mpg.csv file resides:
java -cp ..:../lib/* javasamples.SimpleGGPlot /Users/sv/book/Chapter11