Hi,
I am trying with mikrotik java API to connect to router. I am using libAPI.jar. But I am getting Nullpointer execption. Below the static main code i am using.
ApiConn ret = new ApiConn(“192.168.2.1”, 8728);
if (!ret.isConnected()) {
ret.start();
try {
ret.join();
if (ret.isConnected()) {
ret.login(“admin”, “pas”);
}
else {
System.out.println(“Not Connected”);
}
} catch (InterruptedException ex) {
Logger.getLogger(T3apiView.class.getName()).log(Level.SEVERE, null, ex);
return;
}
}
ret.sendCommand(“/ip/address/print”);
I couldn’t figure out why the connection is failing…
please resolve my problem ASAP…