Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

AccessControlException When Capture screen with Applet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo All,
I Need some help,
I am creating an applet to capture the screen,
when it is as a class with main function, it working,
but when it is as applet, this will throw an exception
java.security.AccessControlException: access denied (java.awt.AWTPermission createRobot)
I read some article, that applet very secure, it can't read local file system.
try
{
SecurityManager security = System.getSecurityManager();
if (security != null)
{
try
{
AWTPermission Aperm = new AWTPermission("createRobot");
security.checkPermission(Aperm);
BufferedImage ScImage = (new Robot()).createScreenCapture(new Rectangle(0,0,800,600));
......
...
}catch(AccessControlException xc)
{
System.out.println("AwtPermission -> Create Robot");
System.out.println(xc.toString());
}finally
{
//System.exit(0);
}
}catch(Exception ef)
{
System.out.println("anom"+ef.toString());
}
is that line correct to get a security access ..?
can anyone tell me how to handle this security, please
Thank in advance,
Best Regards,
Anom
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic