neo1260
Messages postés32Date d'inscriptionvendredi 16 mai 2003StatutMembreDernière intervention 6 décembre 2004
-
6 avril 2004 à 15:44
chaps357
Messages postés1Date d'inscriptiondimanche 10 août 2003StatutMembreDernière intervention28 avril 2004
-
28 avril 2004 à 12:34
bonjour, je test le programme client ftp fourni par ftpBean, kan je le test dans jbuilder il tourne bien mais dés ke je l'éxécute dans une console dos il me met l'erreur
C:\tomcat\webapps\test\WEB-INF\classes\test>java FtpConnect
Exception in thread "main" java.lang.NoClassDefFoundError: FtpConnect
alors ka la compilation tout va bien, voici mon code, merci d'avance pour votre aide
import ftp.*;
public class FtpConnect implements FtpObserver
{
FtpBean ftp;
long num_of_bytes = 0;
public FtpConnect()
{
// Create a new FtpBean object.
ftp = new FtpBean();
}
// Connect to a ftp server.
public void connect()
{
try
{
ftp.ftpConnect("127.0.0.1", "log", "pas");
} catch(Exception e)
{
System.out.println(e);
}
}
// Close connection
public void close()
{
try
{
ftp.close();
} catch(Exception e)
{
System.out.println(e);
}
}
// Go to directory.
public void listDirectory()
{
FtpListResult ftplrs = null;
try
{
// Go to directory '/test'.
ftp.setDirectory("/");
// Get its directory content.
ftplrs = ftp.getDirectoryContent();
} catch(Exception e)
{
System.out.println(e);
}
}
// Get the file.
public void getFile()
{
try
{
// Get the file 'test.txt' and save it to
// the name 'local_file_name' in the hard disk.
ftp.getAsciiFile ("test.txt", "test1.txt","\r", this);
} catch(Exception e)
{
System.out.println(e);
}
}
// Implemented for FtpObserver interface.
// To monitor download progress.
public void byteRead(int bytes)
{
num_of_bytes += bytes;
//System.out.println(num_of_bytes + " of bytes read already.");
}
// Needed to implements by FtpObserver interface.
public void byteWrite(int bytes)
{
}
// Main
public static void main(String[] args)
{
FtpConnect example = new FtpConnect();
example.connect();
example.listDirectory();
example.getFile();
example.close();
}
}