How to Compile Java Programs into EXEs

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024
  • Here's how to take your Java programs and convert them into fully self-contained EXEs. You make a single file, the user double-clicks it, and the program just runs. The user does not need Java, and they don't need to install anything.
    The process involves four steps:
    1. With Eclipse, export your Java program as a "Runnable JAR File."
    2. With Launch4J, wrap that JAR file as an EXE.
    3. With 7-ZIP, bundle the JRE with that EXE.
    4. With 7-ZIP SFX Maker, turn that into a self-extracting EXE that automatically runs your Java program.
    The resulting file is a completely self-contained program.
    If your users already have Java installed, you can skip the last two steps and just use the EXE from Launch4J.

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

  • @rosalbacatino2386
    @rosalbacatino2386 7 месяцев назад +4

    2024 and this still works. Thank you.

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

    Great work! I love the fact that you take people like myself, who are new to coding, into account and help us through the process. Love to see it :)

  • @J-K-AG
    @J-K-AG 6 лет назад +5

    You are unbelievably awesome. I'm going through every single bit of you videos and they r full of surprising info

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

    This tutorial was exactly was I was looking for... And it just worked. Very easy to understand. Thank you.

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

    The fact that you have to go through all of this to get an executable program for a client is why Java never caught on big time.

  • @soo-youngkim309
    @soo-youngkim309 5 лет назад +4

    Great tutorial! I like how you explained every part of the way, making it easier for the viewers to understand. Thanks a lot.

  • @Matthew-ke4ln
    @Matthew-ke4ln 3 года назад +1

    Thank you. Best tutorial. You even showed us your mistakes which is useful in case we ran into the same issues.

  • @shepherdkruse4422
    @shepherdkruse4422 6 лет назад +1

    These videos are so helpful! Thanks for the help!

  • @pemifo260
    @pemifo260 5 месяцев назад +1

    What a cool app that you build!

  • @snake5394
    @snake5394 7 лет назад +2

    This is very helpfull! As usual, great video!

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

    Exactly what I was looking for! Great video for us noobs!

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

    Nice! One question, is this a good practice? Iv'e been seeing some stuff about native bulds, using CMD , some other stuff about jpackager, and jlink (none i have a clue about).

  • @winoline
    @winoline 5 лет назад +1

    So helpful and great video. Thank you

  • @cravkers21
    @cravkers21 6 лет назад +3

    Can't get it to work. 7zip maker way. Pop up says the system cannot find the file specified. It doesn't like the exe. If I zip maker without exe it will recognize the location and open the 7z file as a folder containing jre and telemetry but if I exe the extension it can't locate. Not really sure how to fix the problem on windows. Awesome looking program tho!! Might have to fire up the old laptop just to play with it

    • @birkhansonkan4236
      @birkhansonkan4236 6 лет назад

      Did you "run as administrator"? I got the same pop up and i found out i was not running the 7zip maker as administrator.

  • @yuvarajyv5772
    @yuvarajyv5772 2 года назад +1

    Jar file doesn't show any images in project

  • @tahas2829
    @tahas2829 8 месяцев назад +1

    Thank you.

  • @amthebeast-lolsupportplays599
    @amthebeast-lolsupportplays599 2 года назад +1

    Thanks for this video man

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

    Thanks for the tips! One question, how can I change the program's icon?

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

    Great work, your video is remarkable.
    I applied your method step by step :
    - JAR file creation in Eclipse : no problem ;
    - Creation of an .exe file with Launch4j : no problem ;
    - Creation of a compressed file (.exe + jre) : no problem ;
    - Creating a SETUP with 7-Zip SFX Maker: no problem
    - Test SETUP: Does not work, message: 7-Zip Unsupported method !
    This is really unfortunate, can you help me because I have done various consultations without finding a solution to this problem. For your information, this report was already made on the 7-Zip SFX Maker website, without any answer!
    Thank you for your help.

  • @hoanglinhngodoan364
    @hoanglinhngodoan364 2 года назад +1

    Great ! I love you bro
    +1 subs

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

    Help,Jar file runs but exe made with launch4j doesn't run,it says an error occured while starting the aplication

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

    Great work: I stil have a problem when I try to run the .exe file the cursor shows only the loading blinking icon what can be my problem
    I bundled my files from visual studio code using JAR BUNDLE

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

    Heey It did run but I have three jframes in my project, the main one having buttons to open the other 2. The exe file created only runs the main jframe but the buttons don't open the other jframes 😢

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

    Instead of using launch4j, you could use the junk instruction in my language. A version where you can do that is coming soon. The pnfasm code would look like this:
    VERSION TVOID 1
    JRUN TSTRING ""
    QUIT TNUMBER 0V
    END TVOID 0V
    Assemble with pnfasm, run pnf2cpp, compile with c++ compiler and pretty much, away you go with your java wrapper.

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

      Not junk, oops! Is JRUN.

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

      Of course, you should probably check at least if JRUN is a supported instruction or not. Im possibly inspired to make videos teaching my language(s).

  • @rau149
    @rau149 2 года назад +1

    Cheers to you

  • @birkhansonkan4236
    @birkhansonkan4236 7 лет назад +1

    22:32 is it possible to run the extraction in the background in other words hidden?

  • @birkhansonkan4236
    @birkhansonkan4236 7 лет назад +2

    if you have time could you also make a tutorial on how to run jar files on android mobile phones.

    • @upgrdman
      @upgrdman  7 лет назад +1

      I'm pretty sure that is not possible. Android does not use a conventional JVM. Regarding your other comment, there's a setting in the SFX tool to hide the extraction progress window.

    • @birkhansonkan4236
      @birkhansonkan4236 6 лет назад

      Okey thanks, in the meanwhile i found out to make programs in Android studio for mobile phones. :) :) Sometimes the solution is simpler than i can think of. :)

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

    This does not seem to use the JDK that is in the archive.

  • @ahmaddhuhahabibullah5694
    @ahmaddhuhahabibullah5694 6 лет назад

    Can you show me how to integrate the data to real time clock from computer?

  • @diegodesdecolombia
    @diegodesdecolombia 5 лет назад +1

    How change icon setup? thanks

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

    Wouldn't this be detected as a false-positive virus, since it writes an unknown application on the temp folder?

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

      I've never had that problem. Self-expanding archives are extremely common -- that's how most installers work.

  • @HomelessOnline
    @HomelessOnline 4 года назад

    Do I follow the same steps for a command line java program? I've not yet graduated to GUI programs.

    • @upgrdman
      @upgrdman  4 года назад

      I have not tried it, but it should work the same.

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

    Can you do that again with an IDE that does not use Java?

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

    Hello
    Sir, I made an app using
    java swing +mysql
    How can I convert this code with its mysql database into an application that I can install on my desktop or on any other computer?
    Thanks

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

    Nowadays he would have used Python

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

      Python is a very useful as a scripting language, but has too many drawbacks to be viable for full-featured programs. The two languages serve different purposes.