I am wanting to create a ftp program running in an applet. I have the following code already but I get two errors when I run it. The same code runs fine as an application. Below is the code I have and the errors I get.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import com.enterprisedt.net.ftp.*;
public class Didaftp extends Applet
{
public void init()
{
FTPClient ftp = null;
String host="192.168.0.3";
String user="username";
String password="password";
try
{
// set up client
ftp = new FTPClient();
ftp.setRemoteHost(host);
// connect
ftp.connect();
// login
ftp.login(user, password);
// set up passive BINARY transfers
ftp.setConnectMode(FTPConnectMode.ACTIVE);
ftp.setType(FTPTransferType.BINARY);
String[] files = ftp.dir(".", true);
for (int i = 0; i < files.length; i++)
{
System.out.println(files[i]);
}
ftp.get("C:/test.txt", "test.txt");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
There errors:
Could not read property 'edtftp.log.level' due to security permissions
Could not read property 'edtftp.log.log4j' due to security permissions
java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.0.3:21 could not connect
Is therea way of getting round this problem?