aspose file tools*
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
Author

truncated class file problem

Jane Dunne
Greenhorn

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
file)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

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: 14350
    
  22

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
Greenhorn

Joined: Feb 14, 2005
Posts: 15
Initially the MapLayer class ran ok on it's own. I'm now trying to build on the app..so 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
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

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: http://aspose.com/file-tools
 
subject: truncated class file problem