【问题标题】:Conversion of .class to jar and .class to exe.class 到 jar 和 .class 到 exe 的转换
【发布时间】:2017-06-26 10:40:13
【问题描述】:

如何转换:

  • 使用 cmd 将类文件转换为 jar 文件?
  • class 文件转 exe 文件?
  • jar 文件到 exe?

我可以将exe文件转换为jar文件吗?

【问题讨论】:

  • 您是想实际编译 Java,还是只为类文件/jar 创建一个包装器?

标签: java jar exe .class-file


【解决方案1】:

类文件到jar文件

用法:jar {ctxu}[vfm0M][jar-file]

[manifest-file] [-C dir] 文件...

选项:

-c  create new archive

 -t  list table of contents for archive

 -x  extract named (or all) files from archive

 -u  update existing archive

 -v  generate verbose output on standard output

 -f  specify archive file name

 -m  include manifest information from specified manifest file

 -0  store only; use no ZIP compression

 -M  do not create a manifest file for the entries

 -i  generate index information for the specified jar files

 -C  change to the specified directory and include the following

file 如果任何文件是目录,则递归处理。清单文件名和存档文件名需要以与“m”和“f”标志相同的顺序指定 指定。

示例 1:将两个类文件归档到名为 classes.jar 的归档中:

`jar cvf classes.jar Foo.class Bar.class` 

示例 2:使用现有清单文件“mymanifest”并存档

将foo/目录下的所有文件放到'classes.jar'中:

jar cvfm classes.jar mymanifest -C foo/ .

将jar文件转换为.exe文件

1)JSmooth .exe wrapper

2)JarToExe 1.8

3)Executor

4)Advanced Installer

Convert .class to .exe is discussed in length here

【讨论】:

    【解决方案2】:

    你一定错过了this。请查看Java Archive (JAR) Files Guide

    并且肯定错过了 Real 的操作方法Make a JAR executable 有多个包装器可以完成这项工作(将 Jar 转换为 exe,特定于平台)。你只需要search in StackOverflow for Jar exe

    【讨论】:

      【解决方案3】:

      要将.class 文件转换(实际上是打包)为.jar 文件,请使用jar tool。然后,您可以使用 Launch4jJSmooth 或其他几个软件包等工具从 .jar 生成 .exe 文件(在网上搜索“jar exe”)。

      【讨论】:

        【解决方案4】:

        如果您使用的是 Netbeans IDE,那么从 .class 文件创建 .exe 文件不会花费太多时间。在 IDE 中,创建一个新项目并将您的 java 程序放入该项目中。现在按照这些步骤-

        1. 右键单击项目并选择属性。
        2. 选择从左侧面板运行,右侧面板进入主类(定义了main方法)。
        3. 再次右键单击项目并选择添加库。选择秋千布局扩展。单击添加库。 4.现在从IDE的运行菜单中选择clean and build。确保您已将此项目设置为主项目。
        4. 打开 CMD 并将目录设置为您的项目。转到“dist”> 并输入 java -jar jarname.jar。
        5. 您的程序现在正在 cmd 中运行。
        6. 打开 launch4j 并提供所需信息。
        7. 运行并享受您的应用程序。

        【讨论】:

          【解决方案5】:

          使用命令行创建 jar 文件。回复http://download.oracle.com/javase/tutorial/deployment/jar/build.html

          类到 exe。回复http://www.javacoffeebreak.com/faq/faq0042.html

          jar 到 exe。回复http://viralpatel.net/blogs/2009/02/convert-jar-to-exe-executable-jar-file-to-exe-converting.html

          可以将 exe 转换为 jar 文件。但涉及逆向工程以发现 exe 中的内容,提取并使用它做任何你想做的事情。在我看来,根本不值得。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2010-11-02
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2021-05-17
            • 1970-01-01
            相关资源
            最近更新 更多