how can I create executable file for the program written on Java?

无人久伴 提交于 2019-11-27 22:36:48
  1. Export .jar in eclipse. (how to)
  2. Use JSmooth (info) to make an .exe file. (how to)

Here is a tutorial that shows you how to make a jar file from eclipse.

If Java is installed on the computer, you can execute your application by doubleclicking the jar file:

http://ecs.victoria.ac.nz/Courses/COMP205_2009T1/TutorialEclipseExportToJar

You didn't mention what platform you are using. There are 2 ways I can think of.

The easiest way is for you to create a *.bat file (in Windows) that contains the java YourApp command line.

If you want to create a more fancy installer and executable, you can use NSIS script to do so. Since you are using eclipse, consider trying EclipseNSIS to generate the NSIS script, which is much faster and easier than writing it yourself from ground up.

The best answer for this situation is to launch the app. using Java Web Start. JWS can not only create desktop and start menu launch items, but provides automatic updates, cross-platform compatibility and much more.

  1. Create a 1-line metafile to specify which class the JVM should look for to start with the main(String[]) method.

  2. Run the command jar cmf [metafileName] [jarfileName] [classfiles] [img/txtDirectories]

  3. You have an executable jar file - type in "java -jar jarfileName" or, directly "jarfileName" at your prompt. On windows, you can also double click on the jar file logo/name to get it started.

Good wishes, - M.S.

PS: Here is the link to a more detailed tutorial: http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!