不兼容的魔法值1008813135

发布于 2024-08-23 20:19:19 字数 548 浏览 8 评论 0原文

我正在编写一个 Java 小程序并将其嵌入到网页中。 它曾经在不同的浏览器中运行 Mac 和 Windows 没有问题。 我在 Mac 上使用 NetBeans 来构建小程序使用的 .jar 文件。

由于某种原因,我决定在 Windows 的 NetBeans 上加载该项目 - 当从任何浏览器访问网页时,我开始在 Windows 计算机上收到以下错误:

java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file

担心这一定是我决定在 Windows 上打开该项目这导致了这个错误 - 我尝试从 Mac 的 NetBeans 构建 - 但错误仍然存​​在。

我在 Mac 上启动了一个新项目并导入了现有的源代码:仍然是同样的问题。

我正在阅读有关此错误的内容,似乎预期的幻数是十六进制的 0xCAFEBABE,十进制的 3405691582,而不是 1008813135。所以看起来 Mac 版本的 Java 不再生成此文件头?锄头可以吗?我没有做任何更新或任何事情。

I am writing a Java applet and embedding it in a web page.
It used to run Mac and Windows in different browsers without problem.
I was using NetBeans on the Mac to build the .jar file the applet used.

For some reason or another I decided to load the project on the Windows' NetBeans - I started getting the following error on the Windows machine when accessing the web page from any browser:

java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file

Fearing that it must have been my decision to open the project on Windows that caused this error - I tried to build from the Mac's NetBeans - but the error persisted.

I started a while new project on the Mac and imported the existing source code: still same problem.

I was doing some reading about this error and it seems that the magic number expected is 0xCAFEBABE in hex which is 3405691582 in decimal, not 1008813135. So it looks like the Mac version of Java doesn't produce this file header any more? Hoe can that be? I didn't do any updates or anything.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

所谓喜欢 2024-08-30 20:19:19

是的,0xCAFEBABE 是 Java 文件通常的前 4 个字节。

1008813135 是拉丁编码中的 ,很可能是 的开头。

因此,它可能是 404 错误 或其他错误页面的开始。

Yes, 0xCAFEBABE is the usual first 4 bytes of a Java file.

1008813135 is <!DO in Latin encoding, which is, in all probability, the start of <!DOCTYPE....

It is therefore likely the start of a 404 error, or some other error page.

简单气质女生网名 2024-08-30 20:19:19

我没有遇到过这个问题,但是谷歌搜索这个错误会产生几种可能的解决方案:

论坛。 sun.com - Java Applet 开发 - 类文件 MyApplet 中不兼容的魔法值 1008813135

感谢上帝,问题解决了。

这是 Java 缓存,因此解决方案是转到 Java 控制面板的“常规”选项卡,然后在“Internet 临时文件”下单击“设置”,然后单击“删除文件”。再次尝试使用该小程序。

“不兼容的魔法值 1008813135”错误?

问题现已解决:我发现我使用的网站主机根本不支持 .jar 文件。我使用 ftp 程序批量上传这些文件,但没有注意到它完全忽略了 .jar 文件。

java 初始化错误

好吧,这是一个 apache 配置问题,从我的 httpd.conf 文件中删除了这一行:

# DefaultType application/x-httpd-php

已解决问题。

I have not experienced this problem, but Googling this error yields several possible solutions:

forum.sun.com - Java Applet Development - Incompatible magic value 1008813135 in class file MyApplet

Thanks God the problem is solved.

Its the Java cache, so the solution go to Java Control Panel, "General" tab, and under "Temporary Internet Files" click "Settings", then click "Delete Files". Try using the applet again.

"Incompatible magic value 1008813135" Error?

The problem is now solved: I found out that the website host I was using didn't support .jar files at all. I mass-uploaded the files with my ftp program and didn't notice that it ignored the .jar files completely.

Errors on java initialization

Alright, so it was an apache configuration issue, removed this line from my httpd.conf file:

# DefaultType application/x-httpd-php

Fixed the issue.

泛滥成性 2024-08-30 20:19:19

如果您使用 Spring 安全性或某种自定义 Servlet 过滤器,请确保存档或代码库位置位于“permitAll”访问权限中。这对我来说是个问题

If you are using Spring security or some sort of custom Servlet Filters, make sure, that the archive or codebase location is in "permitAll" access. This was to problem in my case

晨光如昨 2024-08-30 20:19:19

我遇到了同样的问题。在我的例子中,原因是Applet 使用的所有依赖库都未签名,并且 applet 无法找到它们

所以我在 jsp 文件中添加了所有依赖库以及主小程序,如下所示:

app.archive = '/esense/resources/lib/Applet.jar, /esense/resources/lib/jasypt-1.7.jar, /esense/resources/lib/mysql-connector-java-5.1.30.jar, /esense/resources/lib/runtime-api-1.0.jar';

我还签署了所有 jar。

希望这适用于您的情况。

I was facing the same problem.The reason in my case was all dependency library that Applet uses was not signed and also applet not able to locate them.

So i Have added all the dependent library along with main applet in jsp file like below :

app.archive = '/esense/resources/lib/Applet.jar, /esense/resources/lib/jasypt-1.7.jar, /esense/resources/lib/mysql-connector-java-5.1.30.jar, /esense/resources/lib/runtime-api-1.0.jar';

I have also signed all the jar.

Hope this may work in your case.

夜清冷一曲。 2024-08-30 20:19:19

不兼容的幻数是 html 文件的前四个字节,其中包含一些错误消息,可能是找不到该文件的消息。

当我在小程序标签的代码库元素中没有考虑区分大小写时,我遇到了这种现象。在 Windows 上一切正常,但我使用的互联网服务器运行的是 UNIX,其中文件名区分大小写很重要。在代码和代码库元素中使用所有文件和目录名的大小写解决了这个问题。

The incompatible magic number is the first four bytes of a html file that has some error message in it, probably a message that the file isn't found.

I encountered this phenomenon when I didn't take case sensitivity into account in the codebase element of the applet tag. Things worked well on Windows, but the internet server I was using was running UNIX where filename case sensitivity is important. Making the case of all file and directory names in the code and codebase elements solved the problem.

心在旅行 2024-08-30 20:19:19

我只是单击了 maven-> 更新项目-> 在我的 Spring Boot 中包含快照版本,它就工作了。

I just clicked on maven->update project->include snapshot release in my spring boot and it worked.

避讳 2024-08-30 20:19:19

我在使用 URLClassLoader 从 URL 加载类时收到此错误。
我给它的 URL 是 HTTP,在服务器上我有一个 HTTP 到 HTTPS 的重定向,在类加载时我会收到此错误。

我解决这个问题的方法是,我首先连接到该 URL,并检查我是否被重定向到 HTTPS,如果是,我只需将我调用的 URL 更改为 HTTPS。

I was getting this error while using URLClassLoader to load a class from an URL.
The URL i gave it was HTTP and on the server I had a HTTP to HTTPS redirect, and at class loading i would get this error.

How i fixed it is i first connect to the URL and check if i'm being redirected to HTTPS, if I am, i just change the URL i call to be HTTPS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文