Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating executable file in IntelliJ for Windows

I used to work on an IntelliJ project that was started before I started working on it. This project had a configuration that allowed me to generate an EXE file that could easily be sent to windows users.

It would generate a massive EXE file bundled with all the needed JARs of the application, and upon running it the first time, it would silently "install" itself into the AppData folder, as if it were a regular windows setup file, even though the user would not even notice it doing that installation.

I am trying to configure a project in IntelliJ to do the exact same thing, but first I have not been able to output the exe file by selecting "exe" as the Java FX native bundle type. It just generates a .jnlp and .jar file. When I select "all", as per some other post here in stackoverflow, it generates an exe file, but only with a few kb in size, which does not contain any of the .jar files that should be part of it. Moreover, when I try to open it, it just crashes saying the main class was not found.

Am I missing some setting for building the project? I am using IntelliJ 2018.3.2

Here are some screenshots:

enter image description here

enter image description here

like image 899
Miguel Mesquita Alfaiate Avatar asked Dec 19 '18 15:12

Miguel Mesquita Alfaiate


2 Answers

I have been able to get past this error, after changing the verbosity of the compilation and going through the logs.

There was a log message which helped fixing this:

The process complained about the Inno Setup Compiler missing, which was right. Makes me wonder why IntelliJ would have that feature built in if it depends on external tools but does not notify the user clearly of this.

Detected [iscc.exe] version 0.0 but version 5.0 is required.

After going to the Inno Setup site, downloading and installing the tool, I was able to get the executable to be generated.

Now I am struggling with another error, which is the executable complaining about the main class referenced in the Artifact not being found, but at least I have moved past the first problem! Going to tackle this one now...

like image 59
Miguel Mesquita Alfaiate Avatar answered Sep 18 '22 12:09

Miguel Mesquita Alfaiate


The best solution for this is using exe generator software. There is plenty of exe generators out there.

EXE4J is the most simple & easy tool to use.

In EXE4J,
You can upload your main jar file and select the main class.

I think this will be solved your problem.

like image 42
Naween Banuka Avatar answered Sep 22 '22 12:09

Naween Banuka