Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Truncated class file error

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    25
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Truncated class file error

    Hello JavaProgrammingForums, I need a little help.
    A few weeks ago one of my applets got a Truncated class file error, I have no idea how it got there and how to fix it, any help?

    Thanks -Kok

    This is the error btw:
    Exception in thread "Thread-4" java.lang.ClassFormatError: Truncated class file
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$000(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at Class68_Sub21.method1199(Class68_Sub21.java:450)
            at Class68_Sub21.method1198(Class68_Sub21.java:380)
            at Class68_Sub21.method1192(Class68_Sub21.java:88)
            at Class14.method268(Class14.java:109)
            at Class14.method270(Class14.java:137)
            at Class68_Sub27.method1221(Class68_Sub27.java:170)
            at Class68_Sub28_Sub1.method1235(Class68_Sub28_Sub1.java:235)
            at Class68_Sub13_Sub34.method872(Class68_Sub13_Sub34.java:157)
            at client.method15(client.java:1993)
            at Applet_Sub1.method25(Applet_Sub1.java:435)
            at Applet_Sub1.run(Applet_Sub1.java:158)
            at java.lang.Thread.run(Unknown Source)


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: Truncated class file error

    Hello Kok.

    Do you get this error when running the applet locally?

    If not, I think this could be due to the class files being uploaded via FTP in ascii format instead of binary format.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    May 2009
    Posts
    25
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Truncated class file error

    Quote Originally Posted by JavaPF View Post
    Hello Kok.

    Do you get this error when running the applet locally?

    If not, I think this could be due to the class files being uploaded via FTP in ascii format instead of binary format.
    No I'm running it locally

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: Truncated class file error

    Hmm... Are you running this applet from within your IDE or web browser?

    Could you post your code for me to look at please?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  5. #5
    Junior Member
    Join Date
    May 2009
    Posts
    25
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Truncated class file error

    Quote Originally Posted by JavaPF View Post
    Hmm... Are you running this applet from within your IDE or web browser?

    Could you post your code for me to look at please?
    Running from a .bat

    the code is 273 files big

Similar Threads

  1. Reading a file line by line using the Scanner class
    By JavaPF in forum File Input/Output Tutorials
    Replies: 0
    Last Post: April 17th, 2009, 07:34 AM
  2. How to solve NullPointerException in runtime?
    By Koren3 in forum What's Wrong With My Code?
    Replies: 15
    Last Post: April 2nd, 2009, 03:20 AM
  3. Proper output for Non preemptive scheduling problem
    By haygaurav in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 4th, 2009, 06:58 AM