Java executable (.jar) ☕

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 208

  • @BroCodez
    @BroCodez  4 года назад +45

    Create an executable jar with Eclipse IDE
    -----------------------------------------
    1. Right click on Java project (pick a project with a GUI)
    2. Export
    3. Java , Runnable Jar file
    4. At Launch configuration select your project
    5. At Export destination, select where you want this jar file exported to
    6. Finish
    Create an executable jar with IntelliJ
    -----------------------------------------
    1. File , Project Structure , Artifacts , (+) , JAR , jar from module with dependencies
    2. Main Class: select the class containing your main method
    3. OK
    3. Change output directory to where you want this JAR saved to
    6. Apply , OK
    7. Build (top of window in IntelliJ) , Build Artifacts , Build
    If you want an icon, convert an image to a .ico file
    ----------------------------------------------------
    1. icoconvert.com/ (this is a decent site)
    2. Choose your image (file type my vary)
    3. Upload
    4. Convert to ICO
    5. Download your icon
    Use Launch4j to create an .exe with custom icon
    ----------------------------------------------
    1. Install Launch4j launch4j.sourceforge.net/
    2. Output file: browse for the output destination and name your file ending with .exe
    3. Jar: browse for where you saved your jar or executable jar file
    4. (Optional) Icon: browse for your custom icon (must be .ico)
    5. navigate to JRE tab
    6. Bundled JRE path: Browse for location of your jdk (Example C:\Program Files\Java\jdk-14.0.1)
    7. At the top of window, click the Build Wrapper (gear icon)
    8. name and save the Lauch4j config file where you want
    9. Your application.exe should be saved to your output file location (no longer need previous files)

    • @LauwaliIsaDk
      @LauwaliIsaDk 11 месяцев назад

      Good, please help us on how to do it using CLI like command prompt. Three years ago i create one using cmd on windows but when i try to create one which is very big project that has a packages i fail.

    • @Jeff-zc6rr
      @Jeff-zc6rr 2 дня назад

      Too bad everyone that follows this will realize when they double click on the file it does nothing. Maybe you should explain what to do next.

  • @Do7Flamingo
    @Do7Flamingo Год назад +21

    Simple, stress free and to the point.

  • @Kaizen549
    @Kaizen549 11 месяцев назад +9

    your saying "sit back ,relax and enjoy the show" is just Wow!

  • @saif37278
    @saif37278 2 года назад +4

    Please add more projects to this playlist. That way we will be excited and keep motivated while watching the tutorials.

  • @aidangaskin8978
    @aidangaskin8978 Год назад +4

    Thank you brother. Simple, quick and no unwarranted jargon. Straight to the point of the video.

  • @sodoityourself5920
    @sodoityourself5920 Год назад +7

    Thank you for the amazing and simple video!!
    At first I was facing a problem that it wouldn't run, I'd double click and nothing so when I changed the 'Open with' to -> 'Java(TM) Platform SE Binary' instead of 'OpenJDK Platform binary' it would open normally, just in case anyone was facing the same issues I was!

  • @caidenhiles
    @caidenhiles Год назад +1

    Your videos are the best! I try to search something up and figure it out that way, but it's so complicated! But when I turn on one of your tutorials, I learn so much so quickly! It just becomes so easy!

  • @noah77
    @noah77 4 года назад +8

    Oh, wow!!!!
    I always wanted a way how to make jave program executable.
    This is really... really helpful.
    When you upload game series, I will make that game, then turn it into executable so everyone could play, seriously, you helped me a lot!
    Thank you from the bottom of my heart.

    • @BroCodez
      @BroCodez  4 года назад +4

      You're welcome! Hopefully these steps work for you

    • @noah77
      @noah77 4 года назад +4

      @@BroCodez don't worry bro, it's working:)

  • @oguzhantopaloglu9442
    @oguzhantopaloglu9442 4 года назад +24

    this was EXTREMELY useful and simple. Thank you so much. I really like the content you create. Please do more project type of videos in the future (like creating java games or simple projects)

    • @BroCodez
      @BroCodez  4 года назад +8

      thanks for watching Oğuzhan. I might if the people demand it lol

    • @caidenhiles
      @caidenhiles Год назад

      I demand it bro!

    • @LauwaliIsaDk
      @LauwaliIsaDk 11 месяцев назад

      We demand it really.

    • @i24k3
      @i24k3 11 месяцев назад

      bro is the exe file sharable. i. e if i share that file to my friend (would he be able to run the file) give that he has JRE

  • @TheReal4L3X
    @TheReal4L3X Год назад +4

    bro really tried to sneak his nuclear launch codes folder in there and thought we wouldnt notice 💀💀. jokes aside great video

  • @flamelier
    @flamelier 2 года назад +5

    My program runs fine in eclipse and the JavaFX works great but when I export it as an executable and then try to run it. Nothing happens. Any idea why?

    • @alexlupu3935
      @alexlupu3935 2 года назад

      I have the same problem, how did you solve it?

    • @accidentalgnius
      @accidentalgnius 2 месяца назад

      Go to Project > Properties > Libraries > select an older JDK version (11 worked for me). Now it would work fine.

  • @twisty8005
    @twisty8005 2 года назад +8

    for some reason my jar file doesn't work on another computer, may I ask why? it says " A JNI error has occured, please check your installation and try again"

    • @bactrosaurus
      @bactrosaurus 10 месяцев назад

      Maybe its missing some files?

  • @hassanwho8983
    @hassanwho8983 4 месяца назад

    man thanks to this guy's videos i feel motivated to learn other videos i c teaching feel so dull Bro Code is the best channel for learning i found so far your efforts are much appreciated

  • @jfruit6310
    @jfruit6310 4 года назад +2

    your video is much more worth than many expensive course like your recommendation at first video. thank again bro! :)

    • @BroCodez
      @BroCodez  4 года назад +1

      thanks for watching Jfrauit!

    • @codeJamalonRH
      @codeJamalonRH 2 года назад

      Nice an awesome video like always!
      Commenting for YT algorithm

  • @when2213
    @when2213 Год назад +1

    after i clicked "finished" and "ok" and tried to click the jar file on the desktop and its not running, the cmd just appeared like a second then disappear and wont run. Can you help me

  • @fl3xr
    @fl3xr 7 месяцев назад +1

    nobody talking about how bro casually has a folder of nuclear launch codes?

  • @Overseer190
    @Overseer190 6 месяцев назад

    program quickly appears then disappears. Everything is properly installed. When trying to run it from the cmd line, it claims that it cant find the main class when it's there. How to fix?

  • @accidentalgnius
    @accidentalgnius 2 месяца назад

    Anyone experiencing a problem like : when you try to run nothing happens, Go to Project > Properties > Libraries > select an older JDK version (11 worked for me). Now it would work fine.

    • @accidentalgnius
      @accidentalgnius 2 месяца назад

      Replying to this, So people would notice more.

    • @moath-cz4bk
      @moath-cz4bk 14 дней назад

      bro how i can select older one

  • @faizalimuhammadzoda4731
    @faizalimuhammadzoda4731 2 года назад

    Very simple explanation. Very humble teacher.

    • @codeJamalonRH
      @codeJamalonRH 2 года назад

      Nice an awesome video like always!
      Commenting for YT algorithm

  • @rul1175
    @rul1175 11 месяцев назад

    I finished C, Java, next MySQL. Thanks a million!!!

  • @RonMatthewSioco
    @RonMatthewSioco Год назад +1

    hey brocode, i just wanna ask about this weird situation, somehow my app does not open when its on desktop, but when its inside my dist folder it works perfectly fine. can anyone help? id really appreciate it.

  • @fraionhyudz7053
    @fraionhyudz7053 Год назад +1

    Bro, do you have tutorials on how to do it in vscode? I exported mine as jar file and after I open it, it does nothing

  • @daniellamek1079
    @daniellamek1079 Год назад +1

    Thank you very much for this great and simple tutorial ! 🙂

  • @jankubik2838
    @jankubik2838 3 года назад +2

    Very good. Can you show us also how to make an executable jar from JvaFX project, pleae?

  • @mehmetkeskin8118
    @mehmetkeskin8118 23 дня назад

    🖐maven projects (ie. making 3d drawing ) can not be opened after exporting to jar file. is there another way to make them jar file in eclipse. Thanks❤.

  • @raidenmgs7608
    @raidenmgs7608 3 года назад +5

    For some reason, the images I added to my program don't show up in the .jar application, however, they do show up when I run the program in NetBeans. Is there any solution to this problem?

    • @pho328
      @pho328 Год назад

      hi, i am having this same problem as you, how did you solve it? please help me.

    • @shani7235
      @shani7235 Год назад

      Copy those which you use in your profgram and past you jar program folder

    • @mrz3134
      @mrz3134 Месяц назад

      Yeah my icon shows up on the executable but not on the jframe itself.

  • @Graham_Patch
    @Graham_Patch 10 месяцев назад

    Thanks so much for this video. It has all the information and is straight to the point.

  • @somethingelse401
    @somethingelse401 3 года назад +2

    Thank you! Easy to follow perfect guide!

  • @soccerstuff
    @soccerstuff Год назад +2

    when i do it, the jar file doesnt include images and other resource files (in Eclipse)

    • @gofchu
      @gofchu Год назад

      Hello, I run into the exact problem. Can you help me?

    • @soccerstuff
      @soccerstuff Год назад +1

      @@gofchu idk my problem is still there, idk how to fix it.

  • @finnickaldrich2208
    @finnickaldrich2208 3 года назад +1

    Can you show us on how to do it on the terminal?

  • @hamidja1537
    @hamidja1537 2 года назад

    Thanks for sharing

  • @oskarremvang1226
    @oskarremvang1226 3 года назад +1

    I love your videos man. They help me so much as a new programmer trying to learn java.

  • @BrianKeeley-wo4fj
    @BrianKeeley-wo4fj 7 месяцев назад

    Bro has the nuclear launch codes casually on his desktop

  • @ngcobonkululeko402
    @ngcobonkululeko402 Год назад

    maybe my java is configured incorrectly but i followed your exact instruction exactly but it didn't work even the one with the original java icon didn't open

  • @wolanus
    @wolanus 4 года назад +1

    You made my day, bro. As always, great video.

  • @khalidbinahsanshuvo
    @khalidbinahsanshuvo 5 месяцев назад

    bro u are a lifesaver huge respect man

  • @longkesh1971
    @longkesh1971 Год назад

    Thank you for making these videos.

  • @orangeplanet9202
    @orangeplanet9202 6 месяцев назад

    when im running the application in the ide it have no problem at all until i try to make my jar file executable:
    Error: JavaFX runtime components are missing, and are required to run this application

  • @naliszorn
    @naliszorn 3 года назад +1

    Hey, nice Tutorial, but i can't get the Jar Working. i don't know how to solve. Error: A JNI error has occurre, please check your Installation and try again ? Windowname: Java Virtual Machine Launcher, ive made a Quiz with your other Tutorial with Swing

  • @duynguyen-ee5yz
    @duynguyen-ee5yz Месяц назад

    hello sir, i followed your steps and exported the app successfully. However, when I open the application, although the functions seem to run normally, I cannot hear the sound I assigned to the button every time I press it. Is there any way you can help me, thank you very much

  • @christianfernandez3166
    @christianfernandez3166 2 дня назад

    Hi Bro, i got a problem converting my JavaFx project into a .exe file. I followed all the steps but, when i tried to open the final file, it didn't work... The file doens't open correctly and idk if i need to add some plugins or depences. If you have time, can you show me how to convert a javafx into .exe file with a video. Thx

  • @anusubbi4286
    @anusubbi4286 3 года назад +1

    while exporting it's export in zipped format folder not like runnable file. how slove this??

  • @trxlly
    @trxlly 3 года назад +5

    Hey! I had a problem after converting the jar file to exe, when i run the exe file, it says - 'Error- A JNL error occurred, please check your installation and try again', and when i press 'OK' it again shows 'A Java Exception has occurred and it closes. If you know the fix to this problem, please reply to this comment. :)

    • @spidernh
      @spidernh 3 года назад +1

      replying so that other replies will gimme notifs bc I have this issue too

    • @trxlly
      @trxlly 3 года назад +1

      @@spidernh oof

    • @spidernh
      @spidernh 3 года назад +1

      @@trxlly since that comment I have googled and found out that maybe it's trying to execute the jar with a different version of java (like JDK 12 vs JRE 8 or something idk, idrk java versions or anything. someone fixed it by deleting one of the versions of java, I suggest googling it if you understand this stuff

    • @trxlly
      @trxlly 3 года назад +1

      @@spidernh ok thx

    • @narx5250
      @narx5250 3 года назад +1

      have u solved?

  • @codeJamalonRH
    @codeJamalonRH 2 года назад

    Nice an awesome video like always!
    Commenting for YT algorithmNice an awesome video like always!
    Commenting for YT algorithm

  • @ajdndbdjbdj
    @ajdndbdjbdj 10 месяцев назад +1

    What if i use net beans?

  • @Siva-ne6ys
    @Siva-ne6ys 2 года назад +1

    Thank you so much for this video

  • @godfryddolbinczykunical1571
    @godfryddolbinczykunical1571 Год назад

    Cool video. I have question for you: do web applications will destroy desktop, mobile and .jar applications?

  • @almahfuz777
    @almahfuz777 Год назад

    I followed the same way you showed with IntelliJ. But after I run the jar file, it shows "A JNI error has occurred"

  • @Jellonova
    @Jellonova 3 года назад +1

    I can't run my jar files made with jdk14. I have tried using jre8 and using the java.exe in jdk14 but none of them work. Please help

    • @vishalrathore9859
      @vishalrathore9859 2 года назад

      I am also facing the Same problem but the solution did not get.

  • @hyperbhavik
    @hyperbhavik 4 года назад +2

    Thanks but pls help me I followed your snake game tut and when i export it and open it says "error a JNI error has occurred, please check your installation and try again

    • @Alisson-Faoli
      @Alisson-Faoli 3 года назад

      The same thing happens when I send my files to my friends...

  • @tekagon158
    @tekagon158 9 месяцев назад

    There is a problem. If you create an exe from your code, all the pictues(png/jpg...) will disappear from the exe. How to fix?

  • @tusharkudave6105
    @tusharkudave6105 3 года назад +2

    Extremely useful video. This is what I want !!!! Great
    Keep making such great videos.

  • @Snowmanver2
    @Snowmanver2 3 года назад +1

    Thank you, that's extremely helpful!

  • @codeJamalonRH
    @codeJamalonRH 2 года назад

    Nice an awesome video like always!
    Commenting for YT algorithm

  • @habtamusium8646
    @habtamusium8646 Год назад

    many thanks ! happy at your methodology

  • @yagizsenkan231
    @yagizsenkan231 3 года назад +2

    Hey people I got a problem. When I create the .jar file, the images i've used for my program are not involved to the .jar file. So basically when I run the .jar file, it is a white board and some buttons on it.(There has to be my image instead of the white board). Does anyone have any solution or suggestion for this? Thanks.

    • @yagizsenkan231
      @yagizsenkan231 3 года назад

      @@noel9220 My mistake was dragging and dropping them directly into the project folder. I created a new folder called res for the image files and extracted the .jar file with both res and src included. Thanks for your answer though. Have a great one!

    • @mialene9240
      @mialene9240 Год назад

      I’m also experiencing this issue. Can you tell me more about your solution?

    • @gofchu
      @gofchu Год назад

      @@yagizsenkan231 Do you have to create res folder in the src folder?

  • @ReillyReid-b5z
    @ReillyReid-b5z 10 месяцев назад +1

    When i change it to jar it show me white logo not the java logo and I can’t open it

  • @gofchu
    @gofchu Год назад

    Hello. I sent the .exe to my friend and it appears to request for JRE installation. After he install JDK, my program runs, but with only panels and buttons. All images are gone and there is no sound. 😢 (All logic and actionPerformed are still working fine)

  • @amazingsimone
    @amazingsimone Год назад

    Doesn't do anything after I press build in "Build artifacts" menu... (ofc I did everything exactly like u did)

  • @idlecsfr
    @idlecsfr 2 месяца назад

    the exe doesn't open...why? i followed all your steps

  • @puneetshakya3001
    @puneetshakya3001 3 года назад

    Simply genius bro

  • @yuryaraujo1612
    @yuryaraujo1612 Год назад

    Exactly what I was looking for! Thanks Bro!

  • @ayman8509
    @ayman8509 3 года назад +1

    how can i include a jvm to my project so i can send it to my friend without him having to dowload one

  • @ritsathya6737
    @ritsathya6737 3 года назад

    Thank you so much. You're the best teacher.

    • @codeJamalonRH
      @codeJamalonRH 2 года назад

      Nice an awesome video like always!
      Commenting for YT algorithm

  • @samiyeelalim
    @samiyeelalim Год назад +1

    can i have the nuclear launch codes?

  • @stormybear4986
    @stormybear4986 3 года назад

    Great tut. II'm kinda ' old school, I prefer to do it on the command line. Thanks1

  • @exitspree
    @exitspree Год назад

    If I were to wrap my program of several classes, folders and serialized files into an executable, would the executable contain all of this? Ergo, would it suffice to place the executable in a root folder and send that folder over to another pc so they could execute it without issues where it would automatically generate the necessary serialized files into the root folder on execution?
    I'm sorry if this is a stupid question. I'm completely new to coding and I've been learning SO MUCH over the last few weeks but the overall structure of things and how to properly apply OOP is still somewhat of a maze to me.

  • @Blaze_-is9yb
    @Blaze_-is9yb Год назад

    Can make it as an standalone executable, where u dont need jvm to run?

  • @eugenezuev7349
    @eugenezuev7349 5 месяцев назад

    understandable and comprehensible

  • @rinadem5219
    @rinadem5219 Год назад

    amazing
    QUESTION

  • @yusuphmwaigomole3104
    @yusuphmwaigomole3104 2 года назад

    This is what I wanted the most

  • @Leonytp
    @Leonytp 2 месяца назад

    MUSIC IS FROM FROM KINDERGARDEN!!!!!!!! (i think)

  • @robertraafat413
    @robertraafat413 2 года назад

    Fellow bro

  • @lightonkamangamefgi2442
    @lightonkamangamefgi2442 2 года назад

    Just what I was in need of.
    I can only say Thank you.
    and thank you for the invitation.
    I'm in

  • @kishutissue
    @kishutissue Год назад +1

    vscode user sitting in the back 🗿

  • @yusufaksoy3693
    @yusufaksoy3693 Год назад

    nice tutorial

  • @akashdatta2002
    @akashdatta2002 Год назад

    Cn i please get those neuclear launch codes from 4:52???

  • @percivalgebashe4376
    @percivalgebashe4376 Год назад

    Nice

  • @matchkraft4296
    @matchkraft4296 Год назад

    Best tutorial, thanks

  • @s.s.mahmudturza7294
    @s.s.mahmudturza7294 Год назад +1

    Hello sir, I am trying to create an executable jar file of a javaFx project so that I can open it with double click anytime. But in this process a normal jar file(not executable) is being created everytime. Thus it's not opening. How can I solve it? I'm using intellij.

    • @obiwan5470
      @obiwan5470 3 месяца назад

      Bro you got any solution ?

    • @s.s.mahmudturza7294
      @s.s.mahmudturza7294 3 месяца назад

      @@obiwan5470 no brother, I coudn't find any😔

  • @Chuboi256
    @Chuboi256 5 месяцев назад

    thanks :D
    helps a lot to know this trick

  • @kemann3815
    @kemann3815 2 года назад

    Awesome

  • @bibekpokhrel2392
    @bibekpokhrel2392 10 месяцев назад

    The jar file is created but doesn't respond when I open it??

  • @HelPfeffer
    @HelPfeffer Год назад

    I liked this video

  • @alisrour84
    @alisrour84 Год назад

    bro you are so helpful thanks for your work

  • @MrOles46
    @MrOles46 3 года назад

    Thanks, really helpful! 🤝

  • @omererkul1669
    @omererkul1669 3 года назад

    Bro help me out, i cant make runnable JAR file with the VM argument inside, so i need to call this Jar file with the VM argrument in cmd, i dont know how to open my JavaFX program by simple click?

  • @carsmadness8555
    @carsmadness8555 10 месяцев назад

    when I double click on the file it does not open. it does not do anything

  • @igorsantanas
    @igorsantanas 2 года назад

    Wow, that was great. Thank you!!

  • @justjake9047
    @justjake9047 3 года назад +1

    When I click on the jar it does nothing
    I watched every tutorial and read every forum
    What am I doing wrong?

  • @coolguy652
    @coolguy652 2 года назад +2

    Hello. I really appreciate your videos, keep up the good work!
    I encountered a problem with the Launch4j program. When I tried to use the "Build wrapper" function, I got this Error message: "net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "./bin/ld": error=2, No such file or directory"
    Any help is much appreciated :)

    • @raffazaver
      @raffazaver Год назад

      it's been a year since you wrote your comment but just in case,,, i had the same problem when i tried to do a cmd command and i had the same problem in my case with the cmd program i did this:
      String command = "ipconfig"; // Just the command name without "cmd /c" for Windows
      // Create a ProcessBuilder
      ProcessBuilder processBuilder = new ProcessBuilder("cmd.exe", "/c", command);
      // Redirect the error stream to the output stream
      processBuilder.redirectErrorStream(true);
      // Start the process
      Process process = processBuilder.start();

  • @gogoi.
    @gogoi. 3 года назад +1

    Thank You

  • @salaheddine6556
    @salaheddine6556 3 года назад

    When I convert it to .exe program , and tried to send it to my friend to try it in his pc , his windows didn't let him install it WHY???

  • @shubhambelwal674
    @shubhambelwal674 7 месяцев назад

    ❤❤

  • @devadhisesh3422
    @devadhisesh3422 3 года назад

    bro please help me my .jar file is opening but its only a 500x500 blank
    but when i run in eclipse it runs with image

  • @Hortzy
    @Hortzy Год назад

    Does this work / is the process the same on Mac?

  • @donatellodonini3147
    @donatellodonini3147 2 года назад

    what if I don't have a gui? why does not open a terminal?

  • @sofaxx5447
    @sofaxx5447 2 года назад

    but why should i do this in the first place Bro ? can i still run my Gui programme directly without .jar file ??

  • @double8432
    @double8432 Год назад

    mine just keeps on closing...

  • @diwashbhatta4594
    @diwashbhatta4594 2 года назад

    Bro does we edit jar file , i have a assignment given jar file of graphics of a turtle where i have to edit a code and make a turtle to move but jar cant even access in eclips its shows source not found and in intelijj it runs but cant run