0

Just like in the title. I'm having problems with it. I'm a beginner to building apps, I wrote a small program with a GUI for my work and when I converted the .jar using launch4j into .exe I can't test it because of multiple errors. I solved a few of them but I'm stuck on error like this:

Caused by: java.lang.NoClassDefFoundError: javax/mail/search/SearchTerm
  • Does this answer your question? [How can I convert a .jar to an .exe?](https://stackoverflow.com/questions/4330936/how-can-i-convert-a-jar-to-an-exe) – Teddy Dec 18 '22 at 21:00
  • Not really. I have some kind of error there so maybe I did something wrong before using "package" in Maven? – Kamil Poniedziałek Dec 18 '22 at 21:42
  • The generated jar does not include any maven information at all. You need to package your program with dependencies so you can run it from the command line. – Thorbjørn Ravn Andersen Dec 18 '22 at 22:05
  • @ThorbjørnRavnAndersen Here is my pom.xml: [link](https://pastebin.com/TkaWdDSZ) – Kamil Poniedziałek Dec 18 '22 at 22:11
  • @KamilPoniedziałek try searching the site for “runnable jar” or ask a senior colleague y – Thorbjørn Ravn Andersen Dec 18 '22 at 22:52
  • Not nearly as simple as it sounds. Making a Jar into a executable is relatively easy with many question/answers been provided over the years, the problem is, these are all light launchers which simply launches the JVM for you (you could do the same think with a batch file, but it's nicer). In order to launch your app, the target system MUST have a JRE installed. – MadProgrammer Dec 18 '22 at 23:10
  • What I've done in the past, is bundled a version of the JRE with a installer, this would install the app and JRE in the "Program Files" directory, create short cuts, all sorts of stuff, and configure the "exe" launcher to make use the embedded JRE. – MadProgrammer Dec 18 '22 at 23:11
  • @MadProgrammer these days Oracle want you to bring your own JRE as part of your deployment – Thorbjørn Ravn Andersen Dec 19 '22 at 18:14

1 Answers1

-1

This helped me: Maven Shade Plugin