Hallo,
ich habe ein Applet das eine FTP verbindung aufbauen soll. Dazu musste ich es erst signieren. OK, hab ich nach langem hin und her auch geschafft. Doch es will immer noch nicht: Naja: Hier mal der code, das html file und noch die exception:
Das html file mit 2 Archiven. Einmal ein Paket mit Klassen und einmal noch das signierte JAR file der Klasse:
Und zuguter letzt die Exception:
Nunja er macht beim Konstruktor von FTPClient() stress. Aber ich habe keinerlei Ahnung warum... Wäre nett, wenn mir jemand helfen könnte. Hinweis: Ich verwende Commons-net-1.4.0! Ein Paket um FTP und andere Protokolle in Java anzusprechen!
Danke im Vorraus!!!
THX JaVa
ich habe ein Applet das eine FTP verbindung aufbauen soll. Dazu musste ich es erst signieren. OK, hab ich nach langem hin und her auch geschafft. Doch es will immer noch nicht: Naja: Hier mal der code, das html file und noch die exception:
Code:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import java.net.*;
import java.lang.Object;
import org.apache.commons.net.ftp.FTPClient;
public class Guestbook extends Applet
{
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
TextField name = new TextField(30);
TextField email= new TextField(30);
TextField hp = new TextField(30);
TextArea message=new TextArea(10, 60);
Button send = new Button("send");
String nameS;
String emailS;
String hpS;
String messageS;
FTPClient f;
//PrintStream print;
//File path;
public void init()
{
panel1.setLayout(new GridLayout(3, 2));
panel2.setLayout(new GridLayout(1, 1));
panel1.add(new Label("Your Name:"));
panel1.add(name);
panel1.add(new Label("Your eMail:"));
panel1.add(email);
panel1.add(new Label("Your HP:"));
panel1.add(hp);
panel2.add(message);
panel3.add(send);
send.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
entry();
}
});
}
public void start()
{
setLayout(new GridLayout(3, 1));
add(panel1);
add(panel2);
add(panel3);
}
public void entry()
{
f = new FTPClient();
try
{
URL pfad = getCodeBase();
//pfad.openConnection();
//String protocol = new String(pfad.getProtocol());
//System.out.println(protocol);
String url = pfad.toString();
f.connect(url);
f.deleteFile("datei.txt");
f.disconnect();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void stop()
{
}
public void paint(Graphics g)
{
}
}
Das html file mit 2 Archiven. Einmal ein Paket mit Klassen und einmal noch das signierte JAR file der Klasse:
Code:
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "Guestbook.class"
archive = "commons-net-1.4.0.jar Guestbook.jar"
width = "500"
height = "300"
>
</APPLET>
</CENTER>
</BODY>
</HTML>
Und zuguter letzt die Exception:
Code:
Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at Guestbook.entry(Guestbook.java:75)
at Guestbook$1.actionPerformed(Guestbook.java:60)
at java.awt.Button.processActionEvent(Button.java:388)
at java.awt.Button.processEvent(Button.java:356)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Nunja er macht beim Konstruktor von FTPClient() stress. Aber ich habe keinerlei Ahnung warum... Wäre nett, wenn mir jemand helfen könnte. Hinweis: Ich verwende Commons-net-1.4.0! Ein Paket um FTP und andere Protokolle in Java anzusprechen!
Danke im Vorraus!!!
THX JaVa