Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: missing type WebcamException when I try to run Webcam.getDefault() #897

Open
Thorium1717 opened this issue Feb 23, 2023 · 0 comments

Comments

@Thorium1717
Copy link

Thorium1717 commented Feb 23, 2023

I am a junior programmer working on a personal project that requires me accessing a webcam in a java file. I found sarxos's webcam-capture and have downloaded it into my project folder. When I run my main class:

   import com.github.sarxos.webcam.Webcam;
   import java.io.File;
   import java.io.IOException;
   import javax.imageio.ImageIO;

  import com.github.sarxos.webcam.WebcamExceptionHandler;
  import com.github.sarxos.webcam.WebcamException; 

  public class Main {
  public static void main(String[] args) throws IOException{ 
    System.out.println("Start Pictures"); 

    Webcam webcam = Webcam.getDefault();

    if (webcam != null) {
        System.out.println("Webcam: " + webcam.getName());
    } else {
        System.out.println("No webcam detected");
    }
}

}

It gives me an error:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    The method getDefault() from the type Webcam refers to the missing type WebcamException
    at Main.main(Main.java:28)

I have tried running their example class that does the same thing and comes with the library:
https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/DetectWebcamExample.java

but it throws the same error

I have tried everything I can think of. If anyone else has run into this issue how did you solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant