how to access file/directories in applets
hello all,
iam new to java please help me .
my program has thrown the exception:
java.security.AccessControlException: access denied (java.io.FilePermission F:\
read)
using applets a dynamic jtree should be displayed.
when a user clicks a node a file should be retrived and display the directories and files in it.
the program code is:
public void mouseClicked(MouseEvent me)
{
TreePath tp = Tree.getPathForLocation(me.getX(),me.getY());
String dirname = tp.toString();
File f =new File("F:\\");
int w =st.length();
String y = st.substring(1,w-1);
File f2 = new File(y);
String v[] = f2.list90;
for(int u=0;u<v.length;u++)
{
System.out.println(v); //checking atleast o/p may display in command prompt.
}
}
any idea reply soon
it's very urgent.
usha>
http://forum.java.sun.com/thread.jspa?threadID=675800
http://forum.java.sun.com/thread.jspa?threadID=675801
http://forum.java.sun.com/thread.jspa?threadID=675802
http://forum.java.sun.com/thread.jspa?threadID=675878
First of all do NOT post your same question more than one time it is verry rude
to post it 4 times.
If another person does what you should have done (use google first) they might end
up in a half or none answered thread because its answered somewhere else or its not on topic.
As for your problem, an applet cannot access local file system unless signed or with a policy,
I'll only give you signing because that's the easy thing to do.
Signing applets:
http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
second post and reply 18 for the java class file using doprivileged
Still problems?
A Full trace might help us out:
http://forum.java.sun.com/thread.jspa?threadID=656028
(if the next response is without a trace I will ignore it)