1

i'm new to Apache maven and in simple question how to make executable jar from Apache netbeans IDE 11.3. i installed jdk 14 and maven .

and this is pom.xml for my simple project. after clean and build the app i cannot open the jar java -version, mvn -version

pom.xml

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • after go to jar location ,open cmd and type ( java -jar SimplePro-1.0-SNAPSHOT.jar) i got this message "no main manifest attribute, in SimplePro-1.0-SNAPSHOT.jar" – tarek saleem Apr 02 '20 at 09:48
  • 1
    You could use maven-shade-plugin https://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html – khmarbaise Apr 02 '20 at 10:18
  • i'm sorry but i dont know even how to add or use plugin to pom.xml or my project ... could you help me.... – tarek saleem Apr 02 '20 at 10:38
  • @tareksaleem Then you should probably first read a bit about Maven before you go on. – J Fabian Meier Apr 02 '20 at 10:41
  • @JFMeier i know ,,,thanks for advice, but old netbeans version create jar with just "enable jar compress file" so easy ,,, after update to Apache just feel lost.....any recommendation to learn maven? – tarek saleem Apr 02 '20 at 10:46
  • You could e.g. start here https://www.baeldung.com/maven – J Fabian Meier Apr 02 '20 at 10:56
  • Netbeans had some setback in functionality in the process of being donated to Apache. To my understanding this is slowly being added back. – Thorbjørn Ravn Andersen Apr 02 '20 at 11:37
  • install jdk , maven ,Apache netbeans ,Maven Repositories downloaded, start java with maven project , make class with name "Main" With main method, make jFrame form "empty" , and call it in main method set it as visible , ,,that is my simple project ,,,,work fine in IDE but after make "clean and build" and try open jar file in target folder or in .m2 folder nothing happen ,,,someone told me to use maven plugins or copy and paste it in pom.xml file but still not working.. so how to install maven in Apache netbeans .or what should i do to be standard for me and every one to run jar outside IDE – tarek saleem Apr 02 '20 at 13:24
  • @tareksaleem To build an executable jar, see (https://stackoverflow.com/q/574594/927493). But you really need to invest time to learn Maven. That is not something you'll learn in 2 hours. – J Fabian Meier Apr 02 '20 at 14:53
  • @JFMeier finally thank you ,,,, put maven-assembly-plugin in pom.xml , clean & build and my app work like charm in IDE and out also ,,,,,,thanks for you all for ur help ,,,,but why i need to learn maven and i only need "maven-assembly-plugin" to make app work outside IDE ,just put it in pom.xml & build the app – tarek saleem Apr 02 '20 at 15:10

0 Answers0