How to create executable JAR using Intellij | How to create a Java executable in IntelliJ?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends welcome back once again to my video tutorial this is lipsa again with you so guys if you remember in my last video I have described how we can convert a simple Java project to Marvin project in intelligent idea so today we will learn how we can create a executable jar file from that Maven project okay so let's get started guys then so this is the project we have created employee subject so in employee service we have two class one is employee okay one is employee and the other one is employee service so in my employee class I have the field like ID name and email and in Employee Service I have the main method inside my main method I just simply convert a employee list to Json object clear and I just print the Json objects so that's all about our employee service project so now we'll convert this employee service project to a executable jar file and run that jar file okay so you know in Java if you have created a chat file then we can execute the dial file in animation okay so we need to create that one now so how we can do this let's map here so first of all what we need to do we need to click here in the file menu then go to Project structure in the project structure you have the option artifacts Okay click on that artifacts then here you have a plus icon click on that plus icon then you have the option like jazz so we want to create a jar file so jar from models with dependencies okay I'll select the substance from models with dependencies so my model name is employee service now this will ask you to provide your main class so let me click here in the browse so that I can give my actual main class name here so I just simply write if I simply write com Dot a package name with the class name okay if I search like com dot up then dot employee see so employee service class is populated here okay so this is my class which contains my main method okay that is nothing but our main class just select this one so this is important remember your manifest file must be inside SSC main resources folder okay SSD main resources folder so I will select this one just leave it as is and click on OK so when you click on OK you can see name of your jar Employee Service Jack and this is the output director where your jar file will be stored that is nothing but Employee Service slash out or out folder will be created then Inside Out folder we have artifact then Employee Service underscore jab so this is the folder where our gen file will be stored clear now Mark here so this is the what dependencies we have added in our convert XML so that dependencies also need to be the part of our executable gel as the jet file will not be executed okay so hold on you might have think we have added the lumberger then Jackson annotation Jackson 4 and Jackson data by but here only we can see kajer Jackson get away Jackson 4 and Jackson annotation so while number is not a part of this gel because Lumber is a compile time tool so it will not be a part of runtime jet plan here we don't require the lumbar gel and timer contact clear so that's why it is not showing over here okay so now we click on apply then okay okay it will create a jar file so let me just expand this project sic main resources meta NS and manifest MF so here in the Manifest MF you can see my manifest version is this one and this is the main class okay com dot app dot employee employee service this entry service contains your main method that's why it is your main class here now we need to build that judgment so how we can build in the menu bar you can see we have a build option so I'll click on this build option then we are going to build the artifacts so click on build artifacts here you have only one jar present so it is showing here only once your employee service check so click on here what is the action we want to build this one so click on build so that will create a chat file inside our out then inside out we have the artifacts in our Architects we have employee service inside this the Jack file will be kept okay now my jar file is ready I hope so out folder is created okay so inside out I have the artifacts inside artifacts I have Employee Service jar inside this folder I have this jar file clear now you can save this Jam 12 with anyone and they can able to run this jar file in their machine clear sofa so I want to now run this jackpot so let me just copy this done file path okay I'll copy the absolute path you can run this jar file in this local terminal of IntelliJ or you can provide this jar file to anyone they can run it in their message so let me open the command line okay so let me open this command line so to run a jar file you know the command is Java hyphen Jack then I'll provide the path so I just copy that path this is my path okay so let me hit enter see we are getting the same response what we are getting in our project okay this will return us the Json object it is nothing but Json objective employee list clear so that's all about how we can create a executable jar file from a existing Maven project using intelligent idea so I hope you like this video please guys do like share and subscribe my channel if you want to see more videos like this stream my next video till then thanks for watching thank you
Info
Channel: Easy 2 Excel
Views: 8,423
Rating: undefined out of 5
Keywords: How to create executable JAR using Intellij, How to create a Java executable in IntelliJ?, How to create JAR file with source code in IntelliJ?, How to build JARs from IntelliJ IDEA properly?, Compile and build applications with IntelliJ IDEA, How to create Java JAR file?, How to create an executable jar using maven?, How to create a JAR file with Maven in IntelliJ, Use IntelliJ IDEA to create an EXECUTABLE JAR With Dependencies Using Maven
Id: TUnJKT4-T3o
Channel Id: undefined
Length: 6min 13sec (373 seconds)
Published: Sat Jun 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.