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.
Asked
Active
Viewed 604 times
0

Joseph Sible-Reinstate Monica
- 45,431
- 5
- 48
- 98

epicgaymer42069
- 17
- 3
-
Are you trying to edit the vanilla Minecraft client, or some third-party mod/plugin/etc.? If the latter, can you provide a link to whatever it is? – Joseph Sible-Reinstate Monica Mar 29 '20 at 01:24
1 Answers
0
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.

Joseph Sible-Reinstate Monica
- 45,431
- 5
- 48
- 98
-
can you recommend a good way of doing that? I tried using javac but it just returns error: cannot find symbol – epicgaymer42069 Mar 28 '20 at 23:30
-
@epicgaymer42069 It sounds like you just decompiled the one file you wanted to change. Decompile them all, and then when you recompile, it will have the symbols that are currently missing. – Joseph Sible-Reinstate Monica Mar 28 '20 at 23:39
-
Alternatively, add the existing jar to the classpath. (Usually easier, because you might need to fix the decompiled code). – Johannes Kuhn Mar 28 '20 at 23:44
-
Well I decompiled them all but I don't know how to compile them all. – epicgaymer42069 Mar 29 '20 at 00:18