Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in Java FTP by (200 points)
I am able to successfully run the Demo java app (from command-line). I am trying to write a java applet to handle FTP. I have the applet signed and everything works until it gets to this point:


FTPClient ftpClient = new FTPClient();
ftpClient.setRemoteHost("spin48.spindustry.com");

At this point, I receive the following error:

java.security.AccessControlException: access denied (java.net.SocketPermission spin48.spindustry.com resolve)

Note: I can use the Demo app to connect to an FTP account on "spin48.spindustry.com". There are no firewalls I am passing thru. This is not secure FTP, just plain old FTP.

Any thoughts?


Thanks,
Randy

4 Answers

0 votes
by (162k points)
You need to grant certain security permissions for this applet to be able to connect to this host. Try googling java.net.SocketPermission.

You'll probably need to either sign your applet or explicitly grant it permission in the policy file.
0 votes
by (200 points)
Thanks for the response. The applet is signed, and I can access the user's file system (to copy files). Everything I read about policy files sounds like they would on my local machine. How could that help with an applet on a webpage that a number of people may be accessing. It is unreasonable to expect everyone to edit a policy file on their machines.

Did I read the information on policy files incorrectly? Is there some way to include a policy file in the JAR file (or somewhere else) where it would be downloaded from the server along with the applet when the user accesses the webpage?

Here is my test applet in question:
http://216.81.179.83/javaapplet/javaftp.html
0 votes
by (162k points)
The purpose of applet security is to prevent people from doing what you are trying to do. So it may require that users either change their policy files or that they disable browser security settings.

If you could include a policy file in a jar, that would make it very easy to get people to use malicious applets.

However I'm not an applet expert so you may find some way around this. Unfortunately there doesn't seem to be a good site explaining this all in detail.
0 votes
by (200 points)
Understood. I realize what I want to do defeats the purpose of the browser security ;) Thanks for the help.

Categories

...