question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webcam.getDafault() throws exception

See original GitHub issue

Just at the initialisation of the Webcam I get the below exception. It seems to happen when webcams cannot be found. If trhe webcam can be found everything works fine. I would not expect the exception to be thrown… I want to test for null in case the webcam is not found…

The first call is:

webcam = Webcam.getDefault();
log4j:WARN No appenders could be found for logger (com.github.sarxos.webcam.Webcam).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
nov 14, 2017 11:21:50 AM uk.chromis.pos.customers.CustomersView <init>
SEVERE: null
com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
	at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
	at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:816)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:879)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:856)
	at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:834)
        at .... ()

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sarxoscommented, Nov 15, 2017

@namitsharma99,

To automatically use default driver (included in main JAR), just remove these two dependencies from your POM:

dependency>
			<groupId>com.github.sarxos</groupId>
			<artifactId>webcam-capture-driver-ipcam</artifactId>
			<version>0.3.4</version>
		</dependency>
		<dependency>
			<groupId>com.github.sarxos</groupId>
			<artifactId>webcam-capture-driver-jmf</artifactId>
			<version>0.3.9</version>
		</dependency>

Also, please use the newest stable version of webcam capture which is 0.3.11. This will be valid for drivers as well if you would like to use non-default one. When main JAR is 0.3.11 then all drivers need to be 0.3.11.

0reactions
sarxoscommented, Nov 16, 2017

Great 😃 Good luck with your project!

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.github.sarxos.webcam.Webcam.getDefault java code ...
Webcam getDefault() throws WebcamException { ; Webcam getDefault(long timeout) throws TimeoutException, WebcamException { ; boolean isWebcamPresent(){ ; Webcam ...
Read more >
Webcam (Webcam Capture 0.3.12 API) - Javadoc.io
Returns: True if webcam has been open; Throws: WebcamException - when something went wrong ... public static Webcam getDefault() throws WebcamException.
Read more >
WebcamException error when using webcam-capture
Webcam webcam = Webcam.getDefault(); webcam.open(); ImageIO.write(webcam.getImage(), "PNG", new File("file_path"));. The error message:
Read more >
com.github.sarxos.webcam.Webcam Maven / Gradle / Ivy
getSizes(); if (sizes == null) { throw new WebcamException("Sizes array from ... static Webcam getDefault() { List webcams = getWebcams(); if (webcams.
Read more >
Using webcam-camera library for switch on my web cam
This one when debuging over "Webcam.getDefault() ". Webcam webcam = Webcam.getDefault(); //Here I get this error Unknown type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found