This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

truncated class file problem  RSS feed

 
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..
 
Java Cowboy
Sheriff
Posts: 16082
88
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?
 
Sheriff
Posts: 23451
46
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.
 
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
Boost this thread!