URCap error when pressing button

Hi together,

i am trying to create a simple URCap. By pressing a button the robot should move to a specific position. As soon as I press the button, i get a error:

image

What could be the issue?

Null pointers usually indicate you are trying to preform a method on an object that has not been instantiated. So what I mean by this is if you have:

JButton myButton;

myButton.onMouseClick(printToTheScreen("Button Clicked"))) //Not a real function, but you get the idea.

You will get a nullpointer every time you clicked the button instead of seeing “Button Clicked” printed to the screen. This is because we have DECLARED myButton, but we have not INITIALIZED it. We need to change the previous code to something like this:

JButton myButton = new JButton("Click Me");  //Adding new JButton() creates an instance of a button. This will avoid the nullpointer

myButton.onMouseClick(printToTheScreen("Button Clicked")))

I will try that. thank you very much!

Also, the stack trace indicates this is taking place in the “start_program()” method, specifically on line 47 of the file testprogramProgramNodeContribution. So look for any variables you’ve created that are using some .methodCall() on that particular line that you haven’t initialized.