title: How to get RPlot to Java using RCaller?
body: <p>I am trying to get RPlot to Java using RCaller but getting below exception.Can any one help me to solve it. Thank you :)
  ...</p>
  <pre><code>     Globals.R_current = &quot;/usr/local/bin/R&quot;;
       Globals.Rscript_current= &quot;/usr/local/bin/Rscript&quot;;
      
       RCode code = RCode.create();
  
       RCaller caller = RCaller.create(code, 
       RCallerOptions.create(Globals.Rscript_current, Globals.R_current, 
       FailurePolicy.RETRY_5, 9223372036854775807L, 100L, 
       RProcessStartUpOptions.create())); 
  
       caller.setRCode(code);
       
       code.addRCode(&quot;volume_ts &lt;- ts(data$volume,start = c(2017,11),frequency = 12)&quot;);
       code.addRCode(&quot;volume &lt;-subset(volume_ts,end=26)&quot;);
       code.addRCode(&quot;real &lt;- subset(volume_ts, start = 27)&quot;);
       code.addRCode(&quot;arima &lt;- auto.arima(volume)&quot;);
       code.addRCode(&quot;estimate &lt;- forecast(arima,h=15)&quot;);
       code.addRCode(&quot;ds &lt;- data.frame(estimate)&quot;);
       code.addRCode(&quot;fpoint &lt;- ds$Point.Forecast&quot;);
       code.addRCode(&quot;autoplot(estimate)+autolayer(real)&quot;);
       code.endPlot();
       
       File file = code.startPlot();
       caller.runOnly();
       ImageIcon i=code.getPlot(file);
       code.showPlot(file);
  </code></pre>
  <p>...</p>
  <p>Getting below Exception:</p>
  <pre><code>      Exception in thread &quot;main&quot; java.awt.HeadlessException
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
        at java.awt.Window.&lt;init&gt;(Window.java:536)
        at java.awt.Frame.&lt;init&gt;(Frame.java:420)
        at java.awt.Frame.&lt;init&gt;(Frame.java:385)
        at javax.swing.JFrame.&lt;init&gt;(JFrame.java:189)
        at com.github.rcaller.rstuff.RPlotViewer.&lt;init&gt;(RPlotViewer.java:49)
        at com.github.rcaller.rstuff.RCode.showPlot(RCode.java:227)
  </code></pre>