marlon1
Goto Top

Problem bei Java und FTP

Hallo face-smile
Ich wollte eigentlich ein Programm schreiben(in Java) was eine Datei von meinem FTP Server herunterlädt.
Dazu wollte ich die Apache Commons Net Library benutzen,
nachdem ich alles eingestellt habe und mir ein Test script im Internet gesucht habe wollte ich es austesten.
Nur dumm das es nicht richtig geht :/
Es kommt ein Fehler: NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
In der Zeile wo der Fehler sein soll steht:
FTPClient ftp = new FTPClient();

Hier das Script:

import java.io.IOException;
import java.net.SocketException;

import org.apache.commons.net.ftp.*;
 
public class download {
	FTPClient ftp = new FTPClient();
	int reply;
	public void Connect(String username,String password,String serverAdd){
		try {
			
			ftp.connect(ftp.xxx);
			   ftp.login(Benutzername,Passwort);
			   reply = ftp.getReplyCode();
			   
			   if(FTPReply.isPositiveCompletion(reply)){
				   System.out.println("Connected Success");  
			   }else {
				   System.out.println("Connection Failed");  
				   ftp.disconnect();
			   }
			   
		} catch (SocketException ex) {
			ex.printStackTrace();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	 
		
		
	}


}

Danke im voraus! ;)

Content-Key: 320161

Url: https://administrator.de/contentid/320161

Printed on: April 19, 2024 at 00:04 o'clock

Mitglied: 121747
121747 Nov 06, 2016 at 11:50:27 (UTC)
Goto Top
Im Prinzip steht es da ja schon: Er kann die Klassendefinition nicht finden. Da ich nicht weiß, was du alles eingestellt hast, kann ich nur allgemein darauf antworten: Du musst Apache Commons Net in dein Projekt einbinden.

http://commons.apache.org/proper/commons-net/download_net.cgi

Wie du die Jar Datei richtig in dein Projekt in deiner IDE konfigurierst, musst du selbst googlen ("How to add JAR in ...").