Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / December 2004

Tip: Looking for answers? Try searching our database.

applet security problem

Thread view: 
manoj - 09 Dec 2004 16:16 GMT
i added a menu bar in applet .in this menu there is option "open".
when we click on this  Filedialog should open but it is not happening.
some security exception is thrown.
can i change the permission through coding in applet file?
if yes, give me idea of that
Chris - 09 Dec 2004 17:42 GMT
> i added a menu bar in applet .in this menu there is option "open".
> when we click on this  Filedialog should open but it is not
> happening. some security exception is thrown.
> can i change the permission through coding in applet file?
> if yes, give me idea of that

Hi,
An applet isn't allowed to access files on your local hard drive, for
security reasons; I'm assuming this same idea applies to opening file
dialogs. There are two ways around this:

1. If this applet is being used on computers under your control
(corporate LAN, etc), you can find the appropriate policy file for
the Java plugin (I think it's called "java.policy" and can be found
in your JRE/lib/security directory), and add the following lines:

grant codeBase "http://www.example.com/mydirectory/*" {
java.io.FilePermission "<<ALL FILES>>", "read";
};

If you want the code to be able to write to files as well as read,
change "read" to "read,write". For deletion as well,
"read,write,delete". See the javadocs for FilePermission for all the
details. Note that these lines have to be added on ALL the machines
on your LAN that need the applet to work. Also, if any machine is
using Internet Explorer without the Java plugin, I have no idea where
the policy file is (or even if it exists).

2. If this applet is being used on computers not under your control,
the only option is to sign the code. I've never done it, so I don't
know what happens, but, basically, you'll need to sign at least twice
(I think): once for the Java plugin, and once for Internet Explorer
users not using the plugin. To sign code requires a certificate which
you can obtain (at cost) from a certification authority like
Verisign. Once it's signed, I'm not sure exactly where you go from
there.

Chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.