private void jButtonStiahniActionPerformed(java.awt.event.ActionEvent evt) {
//start the Rengine (JRI)
String src,symbol1,symbol2 = null,title;
REXP exp2;
Rengine re = new Rengine(null, false, null);
re.eval("library('quantmod')");
if(!boolOanda){
src="yahoo";
symbol1=jComboBoxSymbols.getSelectedItem().toString();
re.eval("kurz=getSymbols('"+symbol1+"',src='"+src+"')");
exp2 = re.eval(symbol1+"$"+symbol1+".Close");
}
else {
src="oanda";
symbol1=jComboBoxSymbols.getSelectedItem().toString();
symbol2=jComboBoxSymbols2.getSelectedItem().toString();
re.eval("kurz=getSymbols('"+symbol1+"/"+symbol2+"',src='"+src+"')");
exp2 = re.eval(symbol1+symbol2);
}
double[] kurz = exp2.asDoubleArray();
re.end();
}
I got java.lang.NullPointerException
at double[] kurz = exp2.asDoubleArray();
when I try to push this jButton second time . First time everything goes well, but for the second time I have exception. It seems like variable exp2 is null, but I dont understand why. Thank you in advance