making executable file from a java project using NetBeans [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-04 01:50:54

问题


i have created a java project in NetBeans. now i want to make an executable file out of it.that can be executed (run) in other computers that have JDK or JRE installed but don't have NetBeans or any other Java IDE installed.how can i do such thing using NetBeans???


回答1:


Do you mean compile it to JAR? Netbeans does that automatically, just do clean and build (hammer sybol) and look in the dist subdirectory of your project. There will be the JAR with lib folder containing the required libraries. These JAR + lib are enough to run the application.

Maby you unchecked an option:

Project Properties -> Build -> Packaging -> Build JAR after compiling

(but this is enabled by default)




回答2:


You have to build your project. Just click on the hammer in the toolbar. After that there should be a folder in your project called "dist".

In it is the *.jar File, which you can deploy to anybody who has Java installed.




回答3:


you mean executable jar file. which can be executed using $java -jar myJar.jar . So you need to change manifest file inside jar. Second if you want a mouse double click execution then for Linux create .sh and for windows create .bat file containing the above specified $java -jar .

JVM installation is required to do so on whichever machine you want to execute.

Click Me :-)



来源:https://stackoverflow.com/questions/18088607/making-executable-file-from-a-java-project-using-netbeans

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