Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

truncated class file problem

 
Jane Dunne
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jane Dunne
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree, first thing to do is to do a clean recompile and then jar up a new archive to copy to the PDA.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic