JAR to EXE file Bundled With JRE, The Easy Way! (Video #2)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey welcome back guys 80 squared back with the second installment of my series on how to package and bundle your java applications uh to be distributable to your clients or your friends or whomever you're building this application for so last time we left off after creating our runnable jar but it's only executable through the command line and let's face it nobody wants that right so um what we're going to do today we're going to use a program called launch4j it's free to use it's open source you can get it at this website uh the link is gonna be in the description box uh just click here download once it's on your computer uh you can launch it launch for jay uh here it is uh i'm gonna walk you through it it looks a little bit complicated but uh it's it's really not so we're gonna select our jar just um navigate through your through your folders to your application you want to bundle we are going to select where we want to output the exe file uh we're just going to leave in the same folder and we're going to name our file so test application dot exe all right so if you have an icon you want to be displayed on desktops and in the taskbar you can select it here it's it has to be an ico file so if you have one use it um i usually check this so restart the application after it crashes don't worry about this we are not going to need that today since we're going to bundle our own runtime environment with our executable jar so don't worry about this or that if you want to limit the number of instances your application can be run at the same time meaning only one is allowed you can check this and write the name of your application here uh and the title just just write like uh test application and write it again sorry let's just for example and then here in jre this is the runtime environment just right gre if you have a splash screen you want to be displaying uh if you're loading your app so if you double click on the application and you want it to have a load screen with your logo or whatnot you can select it here i never use it because i've never gotten it to work properly it always crashes so if anybody has a solution for this leave it in the comments below in version info you can fill this up this is going to be the information displayed if you right click on an application and go to properties and go to properties this is what you write to be displayed so without we don't need anything else i think so we're just going to save this as a config file if we needed to use it again in the future save and click the gear once you do successfully created here is our runnable application if you double click on it however right now it's not going to work right because it's requiring we we told it to use a java runtime environment located in a folder named jre so that's exactly what we're going to do so create a folder call it gre it's extremely important that it remains in the same folder as our application so navigate to your jdk in my case i am using amazon coretto which is the version of java jdk development kit released by amazon it's free to use you can use whatever you want whatever you have copy the entire content of the jdk go back to your jre folder that you created and paste the entire thing in there it's going to take a bit i'm sure not all these files are required but just to make sure that nothing goes wrong i'm pasting the entire thing so if you double click your app now you got a runnable exe file that is double clickable so now we're getting somewhere right this what you want basically when you're creating an application you want to distribute it people double click on an app on the desktop and it works right why is it so complicated in 2020 somebody has to have an answer for that right so i'm going to show you what you can run into if you distribute this because if you rename the jre file to anything or move this folder you get the error again so rename it to jre it works now again yeah let's make sure so now you got your application in the next tutorial um i am going to show you how to um create an installer that will take care of the files for us uh this is launch for j and if you go there here's our app all right so if i try to open another one it's limited to one instance so you can't open another one while this one is running so this is what we wanted right boom so hope uh this helps thanks for watching in the next installment i'm gonna show you how to bundle this into an installer file that can be distributable and the installer will take care of everything for us it's gonna package and place the right files in the right places so hope you enjoyed see ya
Info
Channel: AD2
Views: 1,181
Rating: undefined out of 5
Keywords: java, javafx, launch4j, maven, intellij, jartoexe, howtocreateexefromjar, deployjar, bundledjre, jre, javaruntimeenvironment, thisapplicationwasconfiguredtouseabundledjavaruntimeenvironmentbuttheruntimeismissingorcorrupted, javafxtutorial, code, programming, programmingtutorial, howto
Id: 51iMSVUOQNM
Channel Id: undefined
Length: 6min 42sec (402 seconds)
Published: Thu Dec 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.