sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.25k stars 1.11k forks source link

[JavaFX Application Thread] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used #727

Open alilopez7 opened 5 years ago

alilopez7 commented 5 years ago

i'm wanna try this code

import com.github.sarxos.webcam.Webcam;

public class Testcamera {
public static void main(String[] args) {
        Webcam webcam = Webcam.getDefault();
        if (webcam != null) {
            System.out.println("Webcam: " + webcam.getName());
        } else {
            System.out.println("No webcam detected");
        }
    }

output run :

[JavaFX Application Thread] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used

My problem is that when I execute the application, the error above is generated and the the application stops.

I am using the following files: bridj-0.7.0.jar slf4j-api-1.7.26.jar slf4j-simple-1.7.26.jar webcam-capture-0.3.13-20180618.102645-4.jar

and the operative system MAC OS MOJAVE version 10.14.5 and the IDE eclipse Version: Photon Release (4.8.0) so I wonder how could I resolve this problem? I would appreciate so much your help.

sarxos commented 5 years ago

Hi @alilopez7,

Just to clarify things. This:

[JavaFX Application Thread] INFO com.github.sarxos.webcam.Webcam - WebcamDefaultDriver capture driver will be used

Is not the error. Errors has ERROR level instead of INFO. If your application is stopped then the reason is different from the one you pointed.

But something is not right in your example. You wrote that this is the code you are trying to run:

import com.github.sarxos.webcam.Webcam;

public class Testcamera {
  public static void main(String[] args) {
    Webcam webcam = Webcam.getDefault();
    if (webcam != null) {
      System.out.println("Webcam: " + webcam.getName());
    } else {
      System.out.println("No webcam detected");
    }
}

And this code is obviously not a JavaFX application. But in the log you provided I clearly see that it comes from JavaFX application (only JavaFX applications are running on JavaFX application thread):

[JavaFX Application Thread] INFO com.github.s ...

Check your environment to investigate what is happening on your side. This may be a silly issue, e.g. are you sure you are running your code correctly? That is, as a Java application and not as a JavaFX application?