Jump to content
xisto Community
Sign in to follow this  
sonesay

Java Applet Security Some frustrating things about it

Recommended Posts

Hi all, Recently I have been developing a Java Applet with my team for our project. This applet runs inside a browser and needs to read files such as images in directories relating to the source files. I have attached a screen shoot of the directory structure generated by netbeans when you build and run the project.

I understand that java applets are not allowed to access the users local file by default unless the applet has been signed by verisign. http://www.verisign.com/?dmn=www.verisign.co.nz The user still has to accept the security certificate I believe before the applet can have access to the local files. This is understandable as you would not want an applet to access things it shouldn't how ever they also seem to block access to remote files as well such as files on the www.

My build folder in the picture has folders for images and when the applet is run under netbeans the applet can still access and use them. How ever when I run the applet through the broswer it does not have access to the files and gives a permission denied error. This I believe is where the security policy of applets restricts access to in my case local user files. I have tried to use relative paths but the applet does not find the image files. Instead I have to use the System.getProperty("user.dir") and append on the child folders. This method works in netbeans as applets running on the applet viewer has different access rights compared to when run through your browser.

String imgUrl = new String(System.getProperty("user.dir") + pathSep + "src" + pathSep + "bg.png");

How then is one able to create an applet that does not require sign certificates that can allow access to image files stored in the child folders of the class files? This is very frustrating and I need to find a solution as soon as possible as my project deadline is closing. I have looked at singing certificates and they seem like they are not free. Am I wrong?

post-45102-1243743345_thumb.png

Share this post


Link to post
Share on other sites

Hi all, Recently I have been developing a Java Applet with my team for our project. This applet runs inside a browser and needs to read files such as images in directories relating to the source files. I have attached a screen shoot of the directory structure generated by netbeans when you build and run the project.
I understand that java applets are not allowed to access the users local file by default unless the applet has been signed by verisign. http://www.verisign.com/?dmn=www.verisign.co.nz The user still has to accept the security certificate I believe before the applet can have access to the local files. This is understandable as you would not want an applet to access things it shouldn't how ever they also seem to block access to remote files as well such as files on the www.

My build folder in the picture has folders for images and when the applet is run under netbeans the applet can still access and use them. How ever when I run the applet through the broswer it does not have access to the files and gives a permission denied error. This I believe is where the security policy of applets restricts access to in my case local user files. I have tried to use relative paths but the applet does not find the image files. Instead I have to use the System.getProperty("user.dir") and append on the child folders. This method works in netbeans as applets running on the applet viewer has different access rights compared to when run through your browser.

String imgUrl = new String(System.getProperty("user.dir") + pathSep + "src" + pathSep + "bg.png");

How then is one able to create an applet that does not require sign certificates that can allow access to image files stored in the child folders of the class files? This is very frustrating and I need to find a solution as soon as possible as my project deadline is closing. I have looked at singing certificates and they seem like they are not free. Am I wrong?

you mean you have a picture file and you used it on applet and the java sand box didnt allow you to access it
so i think you must make jar file and put the picture in it or you must use http and store the picture in web and access it


but if you mean you must access picture which is in client computer, i think you cant access it

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.