I got a JavaFX project, and I got the Fat Jar containing everything, and I successfully created the exe using jpackage, and when I tried launching the exe, it doesn't launch and Windows do something about "Configuring it", what is this? How do I get the actual installer of the app? I provided the jpackage command with:
-- name
-- type
-- icon
-- input
-- main-class
-- main-jar
-- dest
#jpackage
157 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @sacred dome! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 720 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
When I open the Task Manager, it's there in the background tasks
hey contact me when you are free, it is a serious crazy process.
You have to have WiXtoolkit and package it in a certain way, depending on how did you create Fat Jar at first place and do you have a native runtime or not
All of that is needed for me only or everybody who wants to install it?
I made an exe before, long ago, and it works. I don't know why this one doesn't
did you make a exe file using JPackage?
c++ can create exe files since it by default outputs as a .exe
but Java packages code into JAR.
Translating that into native executable requires native translator, wixtoolkit fulfills the gap.
you can watch this video
https://youtu.be/WcPTvRjRIZ8?si=0sYalvab2xAF_XBm
In this video, I will show you how to use jpackage to create .exe installation file on Windows.
But other than that, I can share you my process of packaging too
Make sure you have these plugins:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>Launcher</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.yashgamerx.notepad.Launcher</mainClass>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
You must install Wix Toolset before you proceed furthur.
Run these commands in terminal:
mvn clean package
mvn javafx:jlink
mkdir -p target/app/libs
cp target/notepad-1.0-SNAPSHOT.jar target/app/libs/
jpackage --type exe --name "<File-Name>" --app-version 1.0 --input target/app/libs --main-jar My-JarFile-1.0.jar --main-class org.yashgamerx.Application --runtime-image target/image --dest target/installer --icon src\main\resources\icon.ico --vendor "Yashgamerx"
It might take couple of minutes for packaging based on your size of application.
And your exe will be available in target folder
Why is Wix toolkit necessary?
Read this Oracle doc: https://docs.oracle.com/en/java/javase/25/jpackage/packaging-tool-user-guide.pdf
Page 8 mentions the requirement of WiX 3.0+ for generation of exe and msi
Yes
Okay thanks for the info, will take a look at what you have sent!
this will create most compact application installer.
But how did the old one work? 🙂
Like the exe was made, when I tried opening it, it opened the installer, intalled and it worked normally
you might have forgotten a step from the previous process
running the same installer twice can also cause issues
I had the same issue, I had to uninstall the previous application and reinstall using new installer
jpackaging was also a headache for me when I was doing it for first time 😂.
Thats when I learned that deployment is something nobody teaches you 
First time, yes
make sure you change the main-class name and jar file name from above example
Should I make the app as an installer, or an independent app?
Installer is better, as it packages all the dependencies along with it
So just add the plugins, run the commands then JPackage is ready?
Independent app, will require users to install JavaFX individually sometimes
Like I don't have to run those everytime
Only the jpackage one
Thanks
give it a try and let me know
dont forget to change class names, jar file name and icon name from the above example
Will do
Wait did you mention the way of installing Wix?
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I got this when I ran mvn javafx:jlink
forgot to mention:
are you using this plugin or not?
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>org.yashgamerx.notepad.Launcher</mainClass>
</configuration>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>jlink</goal>
</goals>
<configuration>
<launcher>Opacity-Notepad</launcher>
<jlinkImageName>Opacity-Notepad-Image</jlinkImageName>
</configuration>
</execution>
</executions>
</plugin>
Yeah it's there
does it have same goals?
No goals
version 0.0.8?
yes
wanna hop on voice chat?
Can't. It's middle of the night
Do I just change the whole plugin that I have with this one?
you can
which command failed?
Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.8:jlink (default-cli)
mvn javafx:jlink
seeing your pom.xml is the only option to confirm everything is correct
Whats the actual Main class?
Questioner
I fixed it, still same problem
Then why is it beefing with me?
Thats a crazy beef
Dude I just want a simple installer to hand out to some people D:
I installed Wix, now what?
mvn clean package
mkdir -p target/app/libs
cp target/notepad-1.0-SNAPSHOT.jar target/app/libs/
jpackage --type exe --name "<File-Name>" --app-version 1.0 --input target/app/libs --main-jar My-JarFile-1.0.jar --main-class org.yashgamerx.Application --dest target/installer --icon src\main\resources\icon.ico --vendor "Yashgamerx"
thats without jlink
jlink just decreases the installer size
It says some weird stuff about Windows configuring it
so you are tell me, it is still running in the background?
I got a module file yes
It's running in the background
running installer would definitely ask for windows permissions
That is some weird permission
It's not an installer
It should ask if you allow this app to make changes in your device right? It's not that
something seems to be extremely wrong at this point
did you uninstall previous versions of this application
The installer didn't even open for it to be downloaed in Program Files
The installer is completely fried
the installer never popped up because we never asked him what the users can select before installing
So what should I do 🙂💔
--win-menu --win-dir-chooser
this should pop up menu and allow user to choose directory prior to installation
The background task is always only taking 1 MB of memory
This shit is reminding me of my first time ðŸ˜
I would blame windows at this point
Okay things is getting out of hands
Why the hell is The installer running, but not shown in Task Manager
get some sleep, restart pc and retry tomorrow
lets hope for the best this time
Touching wood
Spent more time packaging than the actual coding
When I saw the exe 5 hours ago with only JPackage, I thought it was easy
Atleast you will be spending lesser time than I did for my first packaging ðŸ˜
I assume it will go till next week
oh yeah 
So any suggestions on what to do before hopping off?
maybe its better you hop off and let the pc get some rest too
Do I just hand people the fat jar and let them run it from the console ðŸ˜
make sure you do not do --win-console
can I get the jar and I can try creating the executable for you?
Smart
Let me hop on again wait
I won't be close minded and obfuscate it first as I am desperate for the installer
Do I give you what is in target/ or app/libs/
ugh wait, The file is bigger than 10 MB
I probably would have to get it from your github release
don't have nitro, let me put it on drive real quick
But wait aren't jars usually less than 0.5 MB?
you can release the jar on github
Is it because it's fat?
yep, FX has to be blamed for that
💤 Post marked as dormant
This post has been inactive for over 720 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use/help ping.
Warning: abusing this will result in moderative actions taken against you.
still a problem exists, keep the thread alive