简体   繁体   English

java.lang.ClassFormatError: 不兼容的魔法值 791617546

[英]java.lang.ClassFormatError: Incompatible magic value 791617546

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.我反编译客户端并在 NetBeans 中编辑 .java 文件(我编辑的很少),然后将文件另存为 .class 文件。 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".我将该文件放回原始 .jar 文件中,当我尝试启动游戏时显示“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.我对java的内部工作非常不熟悉,所以我不太明白这意味着什么。 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.如果有人能告诉我我做错了什么,告诉我如何解决这个问题,或者告诉我可以编辑代码的另一种方式,或者只是向我解释为什么发生这种事情会让我开心。

791617546 in decimal is 0x2F2F200A in hexadecimal, which is // followed by a space and newline in ASCII.十进制的 791617546 是十六进制的 0x2F2F200A,它是//后跟一个空格和 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.鉴于此,您似乎将 Java 源代码直接保存为 .class 文件并尝试将其放入 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.您需要将源代码保存为 .java 文件,然后将其编译为 .class 文件,并将编译结果放在 jar 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM