相关疑难解决方法(0)

如何在java中创建exe文件

嗨,我想为我的Java应用程序创建一个exe文件.

我尝试了一些第三方软件JEXECreator,成功创建了exe文件,并且在我的系统中工作正常,当我尝试使用另一台机器时,它无法正常工作.我收到以下错误

    * The error occurred while running the application. The exit code is 0x10000223.
    * Contact the vendor of the application for troubleshooting.

    java.lang.ClassNotFoundException: com.sample.SampleMain
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.ucware.JEXEClassLoader.run(Unknown Source)
         at com.ucware.JEXEClassLoader.main(Unknown Source)
    **************************************
Run Code Online (Sandbox Code Playgroud)

我知道我设置的类路径有问题.

实际上我想自己创建exe文件而不使用任何第三方软件.

我在很多站点找到了步骤

使用以下内容创建名为Sample.mft的清单文件

         Manifest-Version: 1.0
         Main-Class: 
         Class-path:
Run Code Online (Sandbox Code Playgroud)

在这我有一些疑虑,

  1. 应该如何添加Main-Class,包括完整的包名(com.sample.SampleMain)或类名(SampleMain)或扩展名(SampleMain.class)

  2. 如何添加类路径,我的项目中有4个java类和2个jar.如何在类路径中添加所有这些,我是否需要在类路径中添加java jdk.

  3. 应该保存清单文件的位置

  4. 什么应该是清单文件扩展名(mf或mft)

  5. 在命令提示符下我应该从哪个目录创建exe文件(从我的项目文件夹或src文件夹或包含所有java类的文件夹)

  6. 在命令提示符下创建jar时应该使用什么语法

(jar cmf Sample.mf Sample.jar …

java exe file

6
推荐指数
1
解决办法
8475
查看次数

标签 统计

exe ×1

file ×1

java ×1