Hi all,
I implemented DaemonService from an example project where it’s working. After I implement it in the project I am currently working on I am met with a nullpointer exception upon running the ursim. Can anybody help me?
Here is the error:
java.lang.NullPointerException at com.ur.urcap.examples.mydaemonswing.impl.nodes.installation.MyDaemonInstallationNodeContribution$2.run(MyDaemonInstallationNodeContribution.java:81) ~[?:?] at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_242]
This is the line that is throwing the error:
private void start_python_program() {
new Thread(new Runnable() {
@Override
public void run() {
daemonService.getDaemon().start(); <--- the line that is causing the nullpointer
}
}).start();
}
Here is my MyDaemonDaemonService class:
public class MyDaemonDaemonService implements DaemonService {
private DaemonContribution daemonContribution;
public MyDaemonDaemonService() {
}
@Override
public void init(DaemonContribution daemonContribution) {
this.daemonContribution = daemonContribution;
try {
daemonContribution.installResource(new URL("file:com/ur/urcap/CNC2HMI/_01_App/"));
} catch (MalformedURLException e) { }
}
@Override
public URL getExecutable() {
try {
return new URL("file:com/ur/urcap/CNC2HMI/_01_App/main.py"); // Python executables
} catch (MalformedURLException e) {
return null;
}
}
public DaemonContribution getDaemon() {
return daemonContribution;
}
}
I am not sure what is causing the nullpointer so any help is appreciated.