JAR藏在EXE里面? [英] JAR hidden inside EXE?

查看:99
本文介绍了JAR藏在EXE里面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Minecraft 是一款Java游戏,本周末免费提供。 Windows版本作为exe文件下载。我很好奇EXE文件正在做什么以及从哪里解压缩并运行实际的游戏JAR。所以使用命令,我找到了运行javaw.exe进程的命令行参数;奇怪的是,它是用一个指向可执行文件的类路径启动的! (意思是,.exe文件充当jar)。实际上,在将Minecraft.exe重命名为Minecraft.jar之后,我能够打开它并查看加载器类文件等,好像它是一个普通的JAR文件而不是EXE文件。

Minecraft, a Java game, is free this weekend. The Windows version downloads as an exe file. I was curious what the EXE file is doing and where it's unpacking and running the actual game JAR from. So using a command, I found the command-line arguments to the running javaw.exe process; and oddly enough, it was launched with a classpath pointing to the executable! (meaning, the .exe file was acting as a jar). Indeed, after renaming Minecraft.exe to Minecraft.jar, I was able to open it and see the loader class files and such, as if it were a normal JAR file and not an EXE at all.

这怎么可能?我怎么能用我自己的JAR文件来做呢?

How is this possible? And how can I do it with my own JAR files?

推荐答案

这在以前用过很常见 - 尤其是在空间很珍贵的软盘,解压缩程序与zip文件位于不同的磁盘上是很繁琐的。

This used previously to be very common - especially in the days of floppy disks where space was precious and it was tedious for the unzip program to be on a different disk than the zip file.

之所以可以做到,是因为zip文件库存结构位于zip文件的 end ,而不是前面,所以只要库存结构没有指向,zip文件就可以包含大量初始不相关的字节他们(以及扩展jar文件)。一个非常频繁的用途就是附上一个小的解压缩程序,然后解压缩zip文件。

The reason why it can be done is because the zip-file inventory structure is located at the end of the zip-file, not the front, so a zip file can contain a large number of initial irrelevant bytes as long as the inventory structure does not point to them (and by extension jar-files too). A very frequent use for this has been to enclose a small unzip-only program which could then unpack the zip file.

这个程序前置的一个实用程序是unzipsfx。以下是它的手册页:
http://linuxcommand.org/man_pages/unzipsfx1。 html

One utility to prepend such a program is the unzipsfx. Here is a manual page for it: http://linuxcommand.org/man_pages/unzipsfx1.html

似乎Minecraft使用另一个自行调用Java的程序。

It appears that Minecraft uses another prepended program which invokes Java on itself.

编辑:用十六进制编辑器查看里面。 Minecraft.exe包含在Launch4j中。

Looked inside with an hex editor. Minecraft.exe is wrapped with Launch4j.

这篇关于JAR藏在EXE里面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆