views:

44

answers:

1

First of all I'm not a Java programmer, so maybe (hopefully :D) this problem could be very simple to solve. I've wrote a simple applet to send file from client to a remote FTP server with a third-part library. When I run it in my eclipse applet viewer everything works correctly, but when i try it in my web browser I see a message like this:

Exception in thread "thread applet-prova.class-2" java.lang.NoClassDefFoundError: com/enterprisedt/net/ftp/FileTransferClient
    at prova.start(prova.java:32)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I suppose there is some compiling/packaging issue... the applet should be well signed so, no security problem should be there

+2  A: 

The NoClassDefFoundError means that com/enterprisedt/net/ftp/FileTransferClient was there at compile time but is missing at runtime.

I'm not really an Applet expert but as far as I know, you need to list all dependencies (i.e. including the jar providing the above class) in the archive attribute of the <APPLET> tag.

If you are using <OBJECT> or <EMBED>, see Q: How do I specify a JAR file as part of an OBJECT or EMBED tag? in the FAQ.

Actually, providing the HTML might help here.

Pascal Thivent
the html look like this:<applet width="300" height="300" classpath="bin" code="prova.class" archive="invio.jar"> </applet>the library I use in the file should be inside the jar, altought i'm not sure I've packed it correctly...
ArtoAle
@ArtoAle: Is the library unpacked inside the jar? If it isn't, I don't think it's going to work. Can you run `jar xvf invio.jar` and paste the output in your question?
Pascal Thivent
@Pascal Thiventof course, here it comes:decompresso: META-INF/MANIFEST.MFdecompresso: META-INF/SIGNAPPL.SFdecompresso: META-INF/SIGNAPPL.DSA creato: META-INF/decompresso: prova.classdecompresso: edtftpj.jar creato: com/ creato: com/enterprisedt/ creato: com/enterprisedt/net/ creato: com/enterprisedt/net/ftp/ creato: com/enterprisedt/net/ftp/internal/ creato: com/enterprisedt/net/ftp/test/ creato: com/enterprisedt/util/ creato: com/enterprisedt/util/debug/ creato: com/enterprisedt/util/proxy/dunno how to format more human-readeble way
ArtoAle