Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Java Applet Security


1 reply to this topic

#1 sonesay

    |||[ n00b King ]|||

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 958 posts
  • Gender:Male
  • Location:Auckland
  • myCENT:68.27

Posted 31 May 2009 - 04:28 AM

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.co.nz/codesigning 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?

Attached Files



#2 afshin_a

    Newbie

  • Kontributors
  • Pip
  • 4 posts

Posted 22 March 2010 - 08:07 PM

View Postsonesay, on May 31 2009, 08:58 AM, said:

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.co.nz/codesigning 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




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users