This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

Santiago Escobar Robledo

+ Follow
since Apr 17, 2011
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Santiago Escobar Robledo

It's so late to answer, but to someone this could be useful ...

Daniel Searson wrote:The exception you are getting is because you are in a Java applet and Java applets aren't allowed to access other files. The method getImage() in the Applet/JApplet class is a way around this (I'm not entirely sure how it works, but it does). Creating an ImageIcon using "new ImageIcon()" is not possible because it relies on normal I/O. So you get an access permission exception.

That's true.

So, with ImageIcon you could do two things to avoid the AccessControlException because

1. To grant explicit permission to access local system resources ... resources that you will use in the applet.

You could see the next link about "Security and Permissions":

2. To use ClassLoader

For example:

Everything is in the same path:

- image.jpg
- index.html -> To run the applet

You could see the next link:

By the way, ImageIcon doesn't allow to resize the image. You could see this post: It works perfect.

12 years ago