Hi all, I just joined this group... hope I can be of any much help..
I have this problem with applets, when I run it on the appletviewer is
doesn't show any error but when I deploy the html to a server and acess
it from a browser it shows ClassFormatError : Truncated classfile. I
googled for it and some sites say its a bug in java 1.4 & 1.5. I tried
almost everything and Iam exhausted... .Other sites say I should
recompile and then deploy (doesn't work). One thig though my applet has
a lot of threads and inner classes. Does this have to do anything with
it??
Sincerely
jubs
Chris Uppal - 05 Dec 2005 10:31 GMT
> I have this problem with applets, when I run it on the appletviewer is
> doesn't show any error but when I deploy the html to a server and acess
> it from a browser it shows ClassFormatError : Truncated classfile.
To me this sounds like a problem with the way you transfer the jar/classfiles
to the server. Have you verified that the file(s) on the server are identical
(not just the same length) to the ones on your local system ?
-- chris
--jubs--> - 05 Dec 2005 11:35 GMT
ya i did that... I got fedup with the problem Now I trying to
imlplement it using JNLP. hope that atleast works.
Thomas Weidenfeller - 06 Dec 2005 08:09 GMT
> I have this problem with applets, when I run it on the appletviewer is
> doesn't show any error but when I deploy the html to a server and acess
> it from a browser it shows ClassFormatError : Truncated classfile.
You did set your FTP client to binary transfer, didn't you?
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
--jubs--> - 06 Dec 2005 14:54 GMT
how do u do that???
Thomas Fritsch - 06 Dec 2005 15:09 GMT
> how do u do that???
If you use FTP from command-line, type "bin" (as opposed to "ascii")
after connecting to the server.
If you use a graphical FTP-client, there should be a toggle ("binary"
vs. "ASCII") somewhere in the GUI.

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
Roedy Green - 06 Dec 2005 21:17 GMT
>how do u do that???
Every FTP utility does it a different way. Poke around in options for
auto/binary/ASCII. ASCII flips the line endings to match your server
convention e.g. \r\n -> \n for a Unix server. But if you upload a
class file that way or a jpg, it will scramble it.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Andrew Thompson - 07 Dec 2005 23:47 GMT
> I have this problem with applets, when I run it on the appletviewer is
> doesn't show any error but when I deploy the html to a server and acess
> it from a browser it shows ClassFormatError : Truncated classfile.
Are your classes jar'd?
If so, the class files themselves are not being truncated.
Note that
- Your classes will need to be jar'd for JWS.
- If it works with Jar'd classes for JWS, it should
also work for Jar'd classes as an applet.
[ And JWS'd applets suck. E.G.
Applet <http://www.physci.org/pc/jtest-applet.jnlp>
Application <http://www.physci.org/pc/jtest.jnlp> ]

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew