title: Load data using rJava
body: <p>I use rJava to integrate Java and R in my project.</p>
  
  <p>I need to load GWmodel R package in my application and calculate the distance matrix from Java.</p>
  
  <p>This is my function to load GWmodel and calculating distance matrix :</p>
  
  <pre><code>Rengine engine = new Rengine(new String[] { "--no-save" }, false, null);
  engine.eval("library(GWmodel)");
  engine.eval("data(LondonHP)");
  engine.eval("DM &lt;- gw.dist(dp.locat=coordinates(londonhp))");
  double[][] matrix = engine.eval("DM").asMatrix();
  </code></pre>
  
  <p>But the code result an error :</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at rjavaexm.RJavaExm.main(RJavaExm.java:30)
  </code></pre>
  
  <p>So, I want to know, is it possible to load R package and data using rJava from Java like code above?</p>
  
  <p>Or are there any appropriate ways to do that?</p>