cant i have another solution instead of signing an applet?
Even if i write the code in paint method, i'm getting the same exception..
Writing the code in the paint method won't help. You have to sign it or play around with policy files.
Applets are loaded onto browsers and so giving them access to the files on computers they are running on can pose a security risk. Have a look at all the links I gave you and try to understand what they are talking about.