code: public static boolean isWebcamPresent(){
          try {
              Webcam.getDefault(WebcamConstants.DEFAULT_WEBCAM_LOOKUP_TIMEOUT);
              return true;
          } catch (Throwable exception) {
              LOG.debug("Problem occurred when detecting the webcam. Returning false.", exception);
              return false;
          }
      }
docs: Returns true if there's a webcam available, false otherwise.