Question:
Java applet security problem! Please help?
evilfrenchguy
2010-07-12 03:06:30 UTC
I am writing a Java image uploader applet for a client in which the user uses the JFileChooser to select an image from their machine to be uploaded to a database.

I keep getting a java security exception. I understand why, because no one should be able to simply read files from a person's computer. That could be malicious. However, I know it is possible because several sites use java applets to upload images.

From what I understand, I need to sign the applet, but I am unsure of that process. Can anyone tell me if there is a simple solution to this? I don't have much time to spare.

I will award the most informative answer with 10 points and my sincere gratitude :D

Thanks!
Four answers:
2016-04-12 04:41:02 UTC
I think that someone is pulling a joke on you. That display appears to be just an image file and there is no applet associated.... +add Oh, of course. That's why it's just an image. I thought that you were giving me the link that is supposed to load the applet. You'd need to do that in order to get more help. However, I recommend right clicking and choosing 'view page source' to get more info about the applet.
oho
2010-07-12 03:34:59 UTC
You need to setup a handler for that java security exception.

Sort of like when you read from a text file, you need an io exception handler, to catch the problem if it cannot find the text file..
vincentgl
2010-07-15 12:35:11 UTC
You can't get out of the sandbox by catching exceptions.



Go here: http://www.raditha.com/java/sandbox/

The author of that blog did a great writeup on how to either sign your applet or go a different route.
Moo
2010-07-12 03:47:03 UTC
You need to catch the exception.



try{



//your jFileChooser code



}catch(YourException e){



//message of when the exception happens



}


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...