However when I put it into my GUI application where I would like to run it from I keep getting "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException" when i press the button to turn the camera on.

I know it isn't picking up the webcam device but i can't understand why as it does when i'm not trying to embed it in my GUI.

2 Answers
2

Without more info on your NullPointerException it is impossible to say what is causing the problem. In the stack trace for the exception, you should identify the line in the code you wrote that triggers the exception.
Without any more information, my guess is you don't have an ActionListener registered to the JButton that should start the camera.