How to Convert/Wrap JAR into EXE file and Bundle JRE - Java Extra 33

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 123

  • @RyiSnow
    @RyiSnow  3 ปีที่แล้ว +14

    I've noticed that a JNI error occurs in some environments. When that error happens, pls try to copy your jdk (usually in C:\Program Files\Java) instead of jre and also change the exe path accordingly. Sorry for the trouble!

    • @Iraxvii
      @Iraxvii 3 ปีที่แล้ว

      Hi. When using a JDK instead of a JRE, do you include the entire JDK or just the bin and lib folders? Thank you :)

    • @RyiSnow
      @RyiSnow  3 ปีที่แล้ว +2

      Only bin and lib and it worked for me :)

    • @bluethemcguy4430
      @bluethemcguy4430 2 ปีที่แล้ว

      Thank You So Much!!! This was the exact error I got. Thank you for posting a fix about this problem! :)

    • @griffinbrooks6748
      @griffinbrooks6748 2 ปีที่แล้ว +1

      @@bluethemcguy4430 Haha same! i was trying so much and i was about to comment and then saw this :D

    • @cayman_islands
      @cayman_islands 2 ปีที่แล้ว +3

      the exe file still needs java..

  • @MajinHico
    @MajinHico 4 ปีที่แล้ว +9

    Underrated video, extremely useful. Thank you.

  • @stepanzavadil
    @stepanzavadil 3 ปีที่แล้ว +2

    nice, worked for me
    if you are having trouble with JRE, just put there lib and bin from JDK that you developed on ;)

  • @jonahkollenberg1060
    @jonahkollenberg1060 3 ปีที่แล้ว +2

    You are an actual national hero. Thank you so much. This video saved me. Thank you

  • @RyiSnow
    @RyiSnow  4 ปีที่แล้ว +6

    If your image or other resources don't show up in the exported program, please check if you have specified your resources correctly in your code. Absolute address such as ".//res//image.jpg" doesn't work in exported programs (either jar or exe).
    If you are not sure how to specify resources, check this video that I made a while ago: th-cam.com/video/d02PK8C5EaA/w-d-xo.html

  • @陳a-x9k
    @陳a-x9k 3 ปีที่แล้ว +1

    Thank you so much.by the way if your project is a console only,then you need choose Header Type:Console at Header-->Header Type.otherwise the exe can't to run.

  • @LeoOno
    @LeoOno 4 ปีที่แล้ว +8

    awesome !!! this is something i always wanted to know. i'll definitely try it later, thanks :) !

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว +2

      Good to hear that!

    • @LeoOno
      @LeoOno 3 ปีที่แล้ว

      @@aproe610 hey man, yeah i love @RyiSnow videos :)

  • @CadenKoehl
    @CadenKoehl 2 ปีที่แล้ว +1

    Thank you so much! This was incredibly helpful and informative, you just earned a subscriber!

  • @toshinoriyagi2460
    @toshinoriyagi2460 ปีที่แล้ว +3

    Has anyone had the same problem and does anyone know how to solve? The JRE tab on Launch4j is a bit different and I don't know what am I doing wrong. I used JDK version 20.0.1 and when I try to create the .exe file it does so, but it doesn't run whatsoever, while it was running as a .Jar file. Thank you in advance guys.

    • @michalmily4605
      @michalmily4605 ปีที่แล้ว

      hi, today I tried this for the first time... and after several errors I finally ran it. I used lib and bin folder from jdk-17. In JRE settings in launch4j(v. 3.50) i checked "JDK required" (min. JRE version 1.6.0). with these settings i am able to run it on different PCs.

  • @masoudhasanlu299
    @masoudhasanlu299 10 หลายเดือนก่อน

    very good explanation, thank you

  • @perronegro4077
    @perronegro4077 3 ปีที่แล้ว +1

    Thank you very much, you helped me a lot.

  • @mimatila
    @mimatila 11 หลายเดือนก่อน

    Great! 2 chinese guys helped a lot lately! Very good way to show things!

  • @Dan-py2kf
    @Dan-py2kf 2 ปีที่แล้ว

    Awesome tutorial, thank you!

  • @michalmily4605
    @michalmily4605 ปีที่แล้ว

    thx for this video. very helpful.

  • @jeandredegenaar9292
    @jeandredegenaar9292 ปีที่แล้ว

    Hi how do I get the .exe to run on the other device if I had to add JVM Options, I added the libraries etc. to the same file and changed the paths to use the one's in the folder. By doing this it runs on my device but not on another device.

  • @1jhonbreinnersdh804
    @1jhonbreinnersdh804 ปีที่แล้ว

    I need help please where I can get that version of launch 3.12 at the moment it is in 3.50 and the jre configuration part of the program is different

  • @tangtai4011
    @tangtai4011 ปีที่แล้ว

    you are my hero! thank you so much!

    • @1jhonbreinnersdh804
      @1jhonbreinnersdh804 ปีที่แล้ว

      I need help please where I can get that version of launch 3.12 at the moment it is in 3.50 and the jre configuration part of the program is different

    • @1jhonbreinnersdh804
      @1jhonbreinnersdh804 ปีที่แล้ว

      It works for me and everything in .exe version but I pass it to another computer and it asks me for jre 17

  • @Rafael-ol1ie
    @Rafael-ol1ie 3 ปีที่แล้ว

    hi, can u show how can i make the application self updtable too?

  • @jokar7882
    @jokar7882 4 ปีที่แล้ว +1

    thank you, you are the best

  • @alexejo8467
    @alexejo8467 4 ปีที่แล้ว +1

    you are the messiah !!!!!!!!

  • @kristopherwerlinder6446
    @kristopherwerlinder6446 4 ปีที่แล้ว +3

    I am getting [Error: A JNI error has occurred, please check your installation and try again] from the JVM launcher and after that another error: [A Java Exception has occured].
    Has anyone had a similar issue or have any hints? Any help is appreciated!
    For context: my .jar file works perfectly fine, I have version 1.8.0 JRE and I use image and wav resources in my jar file.

    • @sparkfire22223
      @sparkfire22223 4 ปีที่แล้ว

      hi, I have EXACTLY the same problem right down to the version of JRE I have which is also 1.8.0 - did you ever get an answer to this question?

    • @ednaldopereira2646
      @ednaldopereira2646 4 ปีที่แล้ว

      i have the same problem

    • @kristopherwerlinder6446
      @kristopherwerlinder6446 4 ปีที่แล้ว

      @@sparkfire22223 I have not found an answer yet unfortunately. My understanding is that with bundled JRE and Jar I can run an executable on any machine. Is this correct?

    • @sparkfire22223
      @sparkfire22223 4 ปีที่แล้ว

      @@kristopherwerlinder6446 I think so - I know that a runnable Jar file can run as long as the machine has Java installed. So if you've got a bundled JRE (which would effectively have Java in the bundle itself) then anyone should be able to run it - just wish the wrapper could work as it would be easier than creating a bundle... I think!

    • @MaDCoN41
      @MaDCoN41 4 ปีที่แล้ว

      same problem here!
      haven't found a fix yet.. :(

  • @ronakkumarpatel9991
    @ronakkumarpatel9991 3 ปีที่แล้ว

    very helpful video, can you please explain if launch4j is not available is there any other way for creating a package of exe file and jre so that programme can run on any operating system

  • @sarikagarg8185
    @sarikagarg8185 3 ปีที่แล้ว

    thank you sir. It is working

  • @untyoowan
    @untyoowan 4 ปีที่แล้ว

    THE KING IS BACK

  • @marcelor.aiello5050
    @marcelor.aiello5050 4 ปีที่แล้ว +2

    Very helpful! / thks

  • @erykne
    @erykne 2 ปีที่แล้ว

    Thank you so much!

  • @harounjaafar6918
    @harounjaafar6918 2 ปีที่แล้ว

    why don't open che exe i follow the step but there is write error whit java:[Error: A JNI error has occurred, please check your installation and try again] from the JVM launcher and after that another error: [A Java Exception has occured]. please help

  • @axelcarre8939
    @axelcarre8939 4 ปีที่แล้ว +2

    Insane dude!

  • @rizaangelim.servilla7723
    @rizaangelim.servilla7723 3 ปีที่แล้ว +1

    hello thanks for the great vid but in my csse it said "error: a JNI error has occurred, please check your installation and try again" "A Java exception has occurred". i have installed the java form the website and did all your instructions but that error occurred …..

    • @Daaninator
      @Daaninator 3 ปีที่แล้ว

      same

    • @Daaninator
      @Daaninator 3 ปีที่แล้ว +1

      I fixed the issue, just replace everything in jre with all the files in c:->program files->java->jdk
      jdk has more information in jre and that's why we get an error

  • @firizz
    @firizz 2 ปีที่แล้ว +1

    I've already done every single step, but when i click on the exe file, nothing happened

  • @stratfender89
    @stratfender89 2 ปีที่แล้ว

    What do you do if you have a Jar file that isn't opening at all? I have made the cookie clicker application as well and even with JRE 1.8 on my computer it won't open. I tried converting it to an executable but it doesn't run still.

    • @RyiSnow
      @RyiSnow  2 ปีที่แล้ว

      Did you select the entry point when you exported?

    • @stratfender89
      @stratfender89 2 ปีที่แล้ว

      @@RyiSnow Yeah, I did and still nothing.

    • @RyiSnow
      @RyiSnow  2 ปีที่แล้ว +1

      The next thing you want to check is whether resource file names are correctly typed. File names are case-sensitive in Jar while not in IDE.
      So typing cookieimage.png to read a file called CookieImage.png still works in IDE but not in Jar. If Jar couldn't read a file, it stops there.

    • @stratfender89
      @stratfender89 2 ปีที่แล้ว

      @@RyiSnow So, I figured out what the problem is. It's a NullPointerException because of the audio player. I took the audio player from your point and click adventure, but this doesn't want to export for some reason :/. I've been going over the code and can't seem to find a solution except to run it in eclipse.

    • @RyiSnow
      @RyiSnow  2 ปีที่แล้ว

      Ah ok, I just checked my P&C code and maybe I found out the cause. If you're putting your audio files in a folder in your res folder (like res/audio), then change the code like this:
      from
      URL sound1 = getClass().getClassLoader().getResource("audio/sound1.wav");
      to
      URL sound1 = getClass().getResource("/audio/sound1.wav");
      *Remove "getClassLoader" and add " / " before the folder name.
      When exported as jar, the ClassLoader cannot find files in a folder created in res and I think I forgot about this when I created that tutorial.

  • @cilaaantro8801
    @cilaaantro8801 ปีที่แล้ว

    hey, when I double click my jar file, nothing happens. I tried doing a runnable jar file instead, and nothing still happens.

    • @cilaaantro8801
      @cilaaantro8801 ปีที่แล้ว

      nvm, I was able to fix it. I saw a reddit post saying to run the jar file on command prompt to see if any errors pop up. Apparently, jar files are much more case sensitive and there were pathfiles that i accidentally capitalized.

  • @pleaseteachme977
    @pleaseteachme977 3 ปีที่แล้ว

    awesome! but how if the computer is different bit?

  • @jasminemerritt1831
    @jasminemerritt1831 2 ปีที่แล้ว

    When I go to specify the main class, why isn't my application package showing up?

  • @nirbhay1564
    @nirbhay1564 4 ปีที่แล้ว

    It works for both 32 bit and 64 bit os??

  • @theanimalqueen8610
    @theanimalqueen8610 3 ปีที่แล้ว

    This does not work for me? I have had 3 different errors depending on the system I try to execute from. 1. is main class not found, 2. is the I see the loading circle and then nothing happens, 3. This version of %1 is not compatible with the version of windows you are running. (this last one is windows 7). any help or suggestions is appreciated. Thanks!

    • @marwenjaffel
      @marwenjaffel ปีที่แล้ว

      Is there a solution "This version of %1 is not compatible with the version of windows you are running" ?

  • @Yudielch2010
    @Yudielch2010 4 ปีที่แล้ว

    Awesome video!

  • @Aaishat
    @Aaishat 9 หลายเดือนก่อน

    Thank you sir

  • @prathamsarankar-csecs-0398
    @prathamsarankar-csecs-0398 4 ปีที่แล้ว

    Hey! It worked but only the stage is visible in another computer.

  • @P4cX
    @P4cX 3 ปีที่แล้ว

    Thanks alot :)

  • @authenticknowledge9349
    @authenticknowledge9349 4 ปีที่แล้ว

    I did exactly what he did and in order for my exe to start in a vmware pc, I had to extract it, so the jre was visible to the file explorer. Any advice would be appreciated.

    • @soni801
      @soni801 4 ปีที่แล้ว +1

      using this method, the jre needs to be visible. afaik there is no way you can put the jre inside the .exe file. the standard thing to do is to copy a local jre to the programs programdata folder, using an external installer.

  • @sparkfire22223
    @sparkfire22223 4 ปีที่แล้ว

    RyiSnow followed your steps exactly - thanks for providing such a succinct and clear guide!
    However, it is not working for me - and I can see another person commenting below has had the same problem...
    I get the error "A JNI Error has occurred, please check your installation and try again". After this it is followed by "A Java Exception has occurred".
    My program works perfectly - within the Eclipse IDE it runs without any problems whatsoever.
    are you able to assist?

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      Hi, I'm not sure exactly but that sounds like a compiler/JDK error so maybe you're compiling with a higher version of Java ? Check your Eclipse's compiler settings and see if the program is complied within the maximum version that you set in Launch4j.

    • @sparkfire22223
      @sparkfire22223 4 ปีที่แล้ว

      @@RyiSnow Hi - It looks like the latest version of Launch4J requires JDK versions 1.6.0 to 1.8.9 -- for anyone downloading the latest Eclipse package, they'll get JDK- 13. So unless there's a solution, it looks like Launch4J hasn't managed to keep up with the latest versions of JDK. Any suggestions? Alternatively I'll see if I can find another solution - thanks for your help.

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      You can change the compiler settings by selecting Windows>Preferences>Java>Compiler on Eclipse. If your compliance level is set as 9 or later, try changing it to 1.8 and see if it works.

    • @christofferosgame_name5095
      @christofferosgame_name5095 4 ปีที่แล้ว

      @@RyiSnow Hi, great video! Does your EXE now contain the JRE? Does this mean that the EXE file takes a larger amount of memory space compared to the JAR file? I am wondering because my EXE and JAR have the same storage space indicating that the JRE is missing in my EXE file.

    • @Valdrox
      @Valdrox 4 ปีที่แล้ว

      @@sparkfire22223 Did you ever get any sort of resolution of this issue? I've spent 3 days now scouring the internet for ways to fix this, and I haven't come up with anything yet.

  • @tanvirrafi7483
    @tanvirrafi7483 4 ปีที่แล้ว

    question
    what if i only send .EXE without the folder will it work?

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      As I mention in the video, EXE file only doesn't work. You need JRE to run Java programs. That's the whole point of this video anyway...

    • @seilimons822
      @seilimons822 4 ปีที่แล้ว

      Is it possible to include the JRE files in the .exe?

  • @sarikagarg8185
    @sarikagarg8185 3 ปีที่แล้ว

    how to make exe for 32bit or 64bit

  • @Stev4iK_FeeD
    @Stev4iK_FeeD 4 ปีที่แล้ว +4

    I don't understand why this video has so few views and likes...

  • @harihabicht6251
    @harihabicht6251 4 ปีที่แล้ว

    thanks a lot!!

  • @khanfriaicha2488
    @khanfriaicha2488 4 ปีที่แล้ว

    please i have to create java+mysql application installer (.exe) can i?

    • @soni801
      @soni801 4 ปีที่แล้ว +2

      not with this method

    • @NinaNina-cz7ym
      @NinaNina-cz7ym ปีที่แล้ว

      ​@@soni801with witch method plzz

  • @mimatila
    @mimatila 11 หลายเดือนก่อน

    How this can be done in Linux?

    • @mimatila
      @mimatila 11 หลายเดือนก่อน +1

      I found it out, lauch4j works both.

  • @melonote-ai
    @melonote-ai 2 ปีที่แล้ว

    Thank you. It is very helpful. Do you have idea how we can bundle the same for Linux? Also, including JRE will increase installation size significantly (around additional 214 MB), right? Thank!

    • @RyiSnow
      @RyiSnow  2 ปีที่แล้ว

      Yes, it should be around that size. As for Linux, I don't have a Linux machine so I cannot check it. Sorry!

  • @fud49
    @fud49 4 ปีที่แล้ว

    it wont work for me, says something about temp/launch4j

    • @griffydz1789
      @griffydz1789 3 ปีที่แล้ว

      write the error on google, most likely has found the solution.

  • @griffydz1789
    @griffydz1789 3 ปีที่แล้ว

    Hello, are you japanese?
    What is your story? I am so curious.
    Did you go to study abroad or something like that
    Thanks for the video

    • @RyiSnow
      @RyiSnow  3 ปีที่แล้ว +2

      Hi, thanks for watching. Yes I am Japanese. I have never lived outside of Japan but I like learning English :)

    • @griffydz1789
      @griffydz1789 3 ปีที่แล้ว

      @@RyiSnow Your video helped a lot, i liked how you took the time to describe lot of details (icon etc), you have a good english accent. Is learning a new langage easier for someone who had to learn tons and tons of katakana hiragana and kanji? hahaa

    • @RyiSnow
      @RyiSnow  3 ปีที่แล้ว +1

      Hmm I don't know for me English is actually a pretty difficult language to learn since the composition of the language is so different from Japanese. They say learning Japanese for English speakers and vice versa is the hardest learning language experience and I kind of want to agree with it :P

    • @griffydz1789
      @griffydz1789 3 ปีที่แล้ว

      @@RyiSnow maybe i can't tell :p (i am speaking English-Arabic, curious about japanese (Daijobou, sasageyo, shotto matte, sumimasen, .. many words i heard from anime), and speak another langage aswell ahah)

  • @신난다-l3d
    @신난다-l3d 4 ปีที่แล้ว

    Oh, I can't see the image in the exe file. Help me.

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      Can you see the image when you export your program as a jar file?

    • @신난다-l3d
      @신난다-l3d 4 ปีที่แล้ว

      ​@@RyiSnow I didn't see your video 'Ext8'. Now I've solved the problem. Your video was really helpful. Thank you. :)

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      No problem :D Glad to hear that you solved the issue!

  • @shubhojeetbanerjee6810
    @shubhojeetbanerjee6810 4 ปีที่แล้ว

    This application requires a java runtime environment 1.6.0-1.8.9 this error is coming.. please someone help

    • @mannyokafor4609
      @mannyokafor4609 4 ปีที่แล้ว

      i have the same problem i will try to create another but without any min or max jre will notify u with results
      Results: Did not work an error message aswell.

    • @fabianvelander
      @fabianvelander 4 ปีที่แล้ว

      just download the java runtime environment like it tells you to do. For me it sent me to the webpage even...

    • @mannyokafor4609
      @mannyokafor4609 4 ปีที่แล้ว

      @@fabianvelander Do you think the user wants to download java?

    • @fabianvelander
      @fabianvelander 4 ปีที่แล้ว

      @@mannyokafor4609 no, that's what this video is for.
      But YOU need to download Java Runtime Environment to run launch4j.

    • @mannyokafor4609
      @mannyokafor4609 4 ปีที่แล้ว

      @@fabianvelander I already have, I mean the user...

  • @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

  • @ClaudioBOsorio
    @ClaudioBOsorio 2 ปีที่แล้ว

    Thanks man. Nice Japanese

  • @homeingbeacan5191
    @homeingbeacan5191 4 ปีที่แล้ว

    What if they delete the JRE file?

    • @RyiSnow
      @RyiSnow  4 ปีที่แล้ว

      Then I think their computer suggests them to install Java.

  • @beebuumba
    @beebuumba ปีที่แล้ว

    A java exception has occurred

  • @jandikable
    @jandikable 3 ปีที่แล้ว

    In python or C# I suspect it would be 5 mb instead of 170 mb ))

  • @kaanyenel5157
    @kaanyenel5157 4 ปีที่แล้ว +3

    you're f*cking gorgeous dude! this is exactly what I am looking for

  • @soni801
    @soni801 4 ปีที่แล้ว

    really cute that u try to speak English :P

  • @nayaunglin5015
    @nayaunglin5015 2 ปีที่แล้ว

    arigatoo

  • @6L6Lcephas
    @6L6Lcephas 4 ปีที่แล้ว

    japanese awesome I don't know

  • @turrnut
    @turrnut 3 ปีที่แล้ว

    日本の口音

  • @cayman_islands
    @cayman_islands 2 ปีที่แล้ว +2

    the exe file still needs java..