java.lang.ClassFormatError: Incompatible magic value 791617546

710 Views Asked by At

I was playing minecraft and the client I was playing on had a bug in it that crashed my minecraft after tabbing out so I wanted to fix that. I decompile the client and edit the .java file in NetBeans(I edit very little) and I save the file as a .class file. I put that file back into the original .jar file and when I try and launch the game is says "java.lang.ClassFormatError: Incompatible magic value 791617546". I looked up the problem and other people seemed to be fixing it with clearing their cache of temporary files but that doesn't seem to work for me. I am very unfamiliar with the inner workings of java so I don't really understand what this means. If anyone can tell me what I'm doing wrong and tell me how I can fix this or tell me another way I can edit the code or just offer me an explanation on why this sort of thing happens that would make my day.

1

There are 1 best solutions below

4
On

791617546 in decimal is 0x2F2F200A in hexadecimal, which is // followed by a space and newline in ASCII. Given that, it looks like you saved the Java source code directly as a .class file and tried to put that in the jar. That won't work. You need to save the source code as a .java file and then compile that to make a .class file, and put the compiled result in the jar instead.