Hello Cody,
the code you are using appear to be OK. The question is, where are you running this code from? Is it a client machine that have a robot installed, or is it a standalone machine? I see you are passing in the host argument.
It appears that if you just use alarm.send() it will use the local spooler to send the alarm, regardless if you have set it in user login.
I tested this code and it uses the local robot.
package com.nimsoft.app;
import java.util.Random;
import com.nimsoft.nimbus.NimAlarm;
import com.nimsoft.nimbus.NimUserLogin;
public class App {
public static void main(String[] args) {
try {
NimUserLogin.login("xxxx", "yyyy", "193.71.55.116");
App exampleprobe = new App();
exampleprobe.doalarmtest(args);
} catch (Exception e) {
e.printStackTrace();
}
}
public void doalarmtest(String[] args) throws Exception {
String basicAlarm = "Alarm generated from Java";
Random r = new Random();
String token = Long.toString(Math.abs(r.nextLong()), 36);
System.out.println("Token" + token);
NimAlarm alarm = new NimAlarm(NimAlarm.NIML_WARNING, basicAlarm, "2", token, "JAVA", null, "8");
alarm.send();
alarm.disconnect();
}
}
But if I provide the controller IP address as an environment variable it will use that instead. E.g. start the program using
-DNIMV_CONTIP=193.71.55.116
Hope this helps, if you have not already figured it out.
Thanks,
Geir.