简体   繁体   中英

Export runnable jar files

Need to export clickable and executable file in eclipse. Simple exporting does not launch the program. How to get a clickable jar?

You should click file , then click export , then click java and save it as runnable jar file .

To run the .jar file, open cmd or terminal, make sure you are in the right path and

type java -jar <jar-file-name>.jar

Note if you cant run it, mostly its your file path not correct

在此处输入图片说明

尝试使用以下链接进行简要介绍: http : //www.wikihow.com/Create-an-Executable-File-from-Eclipse

The code listing represents a command prompt application; you can only make it do anything when physically run on the command prompt / shell itself, especially because it expects user input that way. The reason why turning the given program into an executable jar will result in "nothing" happening when you double click it, is because under Windows the default binding for the 'jar' filetype will be setup to run through javaw.exe - and javaw.exe is designed to not open up any command prompt.

In order to make a program be able to run without the command prompt so you only have to double click on it, you will need to get rid of the command prompt interface and instead build a proper graphical user interface, using for example JavaFX or Swing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM