• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I run an applet for accessing the PC camera

 
Greenhorn
Posts: 5
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm working on my master thesis. I have as subject -face recognition. The subjects should be identified in a webcam/PC camera, locally installed. I mean an USB camera. The application that I developed so far is a web application and I have all the necessary code accessing the camera in Swing, in a JFrame.
Even so I'm not able to port this code to a working applet inside my web app.
I've dug into this for few weeks. The best result I had was a blank applet frame.
The others reported different exceptions, either missing classes under JMF framework, or ( my best friend ) the applet class is not found.
The applet code I have is



and works fine if I run it in Eclipse ->Run as Java applet.

The question is:
Could you point me to a good tutorial or show me something working?
I'll really appreciate if you can give something for dummies or no-brain webcam Java applet programmer.
Thank you
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I saw your code and I have tried to run it , but I go the error



I am wondering if you could solve the problem and willing to share with me how did you solve it . I have kind of similar requirement for my application but I can not access to any webcam local ( USB webcam ) via applet , but swing version work fine .

Thanks
MavajSunCo
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At the very least, the applet needs to be signed: https://coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
 
Daniel Georgescu
Greenhorn
Posts: 5
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could solve it, doing undesired things. Not all are necessary. I don't know if here's allowed to cross post, but I posted on Oracle site, too. There is a long but detailed discussion. You will find every problem I met and how I solved it.
https://forums.oracle.com/forums/thread.jspa?threadID=2215540
I can say 3 things :
- basically it is a problem related to signing the applet
- begin with little steps : creating a file on your system, writing in that file, etc...
- keep an eye all the time in your Java Console in your browser.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Daniel Georgescu wrote:
- begin with little steps : creating a file on your system, writing in that file, etc...



As designed, applets can't access files on the browser's system. They are the wrong tool for what you are trying to do. With enough signature stuff, perhaps on some operating systems, with some browsers you can make it work. But it will always be against the spirit, since a camera is by definition a device that will vary wildly in capabilities. Its hard to write
device independent code when you start out having to deal with device specifics.

I would look for javascript libraries that can access the camera, and skip applets completely.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript has less access to the client system than applets do.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:JavaScript has less access to the client system than applets do.



Didn't know that. Still, Applets seem to me to be a poor match to the OP's requirements.
 
reply
    Bookmark Topic Watch Topic
  • New Topic