File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes truncated class file problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "truncated class file problem" Watch "truncated class file problem" New topic

truncated class file problem

Jane Dunne

Joined: Feb 14, 2005
Posts: 15
Hi, I'm having a problem running an app on my iPaq. The Java version is 1.3.1 and on my desktop it's 1.3.1_13. The app runs fine on my desktop but when I try to run it on the PDA i get the following error:

Exception in thread "main" java.lang.ClassFormatError: MapLayer (Truncated class
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(

I can't tell from the above which of my classes is causing the error. Does anyone know why this might be happening? Any help greatly appreciated..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15087

From the above error message, I'd say it is the class MapLayer that causes the problem. "Truncated class file" sounds like the file MapLayer.class is corrupt in some way.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jane Dunne

Joined: Feb 14, 2005
Posts: 15
Initially the MapLayer class ran ok on it's own. I'm now trying to build on the MapLayer calls on other classes which in turn call other classes etc. It all works fine on my desktop though so I don't think the files are corrupt. Is there any other reason why a class file could be truncated?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Just because a copy of the class works on your desktop, it doesn't follow that some other copy of the class on another computer cannot be corrupted. Truncating a file could happen if copying it from one computer to another was interrupted in the middle of the process.
Barend Garvelink
Ranch Hand

Joined: Dec 07, 2004
Posts: 64
I agree, first thing to do is to do a clean recompile and then jar up a new archive to copy to the PDA.

SCJP 1.4, SCJD 1.4, SCWCD 1.3, ICSD:Websphere 5.1
I agree. Here's the link:
subject: truncated class file problem
It's not a secret anymore!