i'm relatively new to using RJava and was getting a null pointer exception from a piece of code I was trying out. I suspect that this could be due to the data type I am using, but am a bit confused about how to solve this. Any help with this would be amazing.
import org.rosuda.JRI.Rengine;
public class RJava {
public static void main(String a[]) {
String javaVector = "c(put, 0.0425, 66.592, 66.00, 0, 0.068, 0.072, 0.1)";
Rengine engine = new Rengine(new String[] { "--no-save" }, false, null);
engine.eval("library(RQuantLib)");
engine.eval("rVector=" + javaVector);
engine.eval("Euvol=EuropeanOptionImpliedVolatility(rVector)");
double vol = engine.eval("Euvol").asDouble();
System.out.println("Vol=" + vol);
}
}
Exception in thread "main" java.lang.NullPointerException
at co.karan.RJava.main(RJava.java:49)