开发者

From java class file to exe file

开发者 https://www.devze.com 2023-02-25 06:26 出处:网络
I have just created an exe from a java class file using Java Launcher. After double clicking on the exe file it is not e开发者_Go百科xecuting neither gives any response.

I have just created an exe from a java class file using Java Launcher.

After double clicking on the exe file it is not e开发者_Go百科xecuting neither gives any response. What mistake i have done here?


First make a jar file and check it by running from cmd. See the MANIFEST.MF in side jar. It should have main class like this.

Main-Class: com.mypackage.MyMainClass


It is possible that you would have given the name of the main class wrong while making an exe file. Another way of creating exe file from .class file is :

First create jar file of .class files.To do this open cmd, go to the directory where you have .class files of that particular program.Then write jar cvf myjar.jar *.class

A jar file is created in that directory.Then to make an exe file from that jar file you can use jar to exe . When you create exe file using this software it will ask you to give the name of the main class of your program. Enter the main class there and your exe file is created.So as you click that exe file,your program runs.

for directly converting .class file to exe file follow this.


try running your program from the command line to see if there are any errors. One thing you could do is create a jar which is executable in windows which should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消