#jpackage

157 messages · Page 1 of 1 (latest)

sacred dome
#

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

pulsar timberBOT
#

⌛ This post has been reserved for your question.

Hey @sacred dome! Please use /close or the Close Post button 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.

sacred dome
#

When I open the Task Manager, it's there in the background tasks

flat wind
#

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

sacred dome
#

I made an exe before, long ago, and it works. I don't know why this one doesn't

flat wind
#

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

sacred dome
#

Okay thanks for the info, will take a look at what you have sent!

flat wind
sacred dome
#

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

flat wind
#

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 oh_dear

sacred dome
#

Gosh 🥹🥹

#

Packaging is harder than building the app itself

flat wind
#

make sure you change the main-class name and jar file name from above example

sacred dome
#

Should I make the app as an installer, or an independent app?

flat wind
sacred dome
flat wind
#

Independent app, will require users to install JavaFX individually sometimes

sacred dome
#

Like I don't have to run those everytime

sacred dome
sacred dome
flat wind
#

give it a try and let me know

#

dont forget to change class names, jar file name and icon name from the above example

sacred dome
#

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

flat wind
#

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>
flat wind
#

does it have same goals?

sacred dome
#

No goals

flat wind
#

add the same executions

#

just change the launcher and jlink image name

sacred dome
#

Cannot resolve symbol 'configuration'

#

On the config tag

flat wind
#

version 0.0.8?

sacred dome
#

yes

flat wind
#

wanna hop on voice chat?

sacred dome
#

Can't. It's middle of the night

flat wind
#

oh shit 🤣

#

can you send me your pom file?

sacred dome
sacred dome
#

It works now 'no errors'

#

But the command still fails

flat wind
sacred dome
#

Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.8:jlink (default-cli)

sacred dome
flat wind
#

seeing your pom.xml is the only option to confirm everything is correct

sacred dome
#

Why is the Main class Main and not Questioner

#

wait

flat wind
#

oh yeah

#

two different main class

sacred dome
#

But that has no excuse for jlink

#

That is for shading

flat wind
#

Whats the actual Main class?

sacred dome
#

Questioner

flat wind
#

thats my end. it works on mine

#

fix the main class for shade just in case

sacred dome
#

I fixed it, still same problem

sacred dome
flat wind
#

Thats a crazy beef

sacred dome
#

3.9.11

#

version

#

Java 23

flat wind
#

oh_dear , now its a serious problem

#

you can also package it without jlink

sacred dome
#

Dude I just want a simple installer to hand out to some people D:

#

I installed Wix, now what?

flat wind
#
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

sacred dome
#

mhm

#

a jar appeared in libs, and an exe appeared in installer

flat wind
#

🥳

sacred dome
#

Still same problem

#

You do always celebrate early lol

flat wind
#

wait a min, do you have module-info.java as part of the project?

#

thats good

sacred dome
#

It says some weird stuff about Windows configuring it

flat wind
#

so you are tell me, it is still running in the background?

sacred dome
sacred dome
flat wind
sacred dome
#

It's not an installer

#

It should ask if you allow this app to make changes in your device right? It's not that

flat wind
#

did you uninstall previous versions of this application

sacred dome
#

Yes

#

The exes? Yes

flat wind
#

not the exe

#

the application from program files

sacred dome
#

The installer didn't even open for it to be downloaed in Program Files

#

The installer is completely fried

flat wind
#

the installer never popped up because we never asked him what the users can select before installing

sacred dome
flat wind
#

that app is successfully installed on your machine I believe

#

search for the name

sacred dome
#

Didn't

#

Already searched

#

Coding is way too easy compared to this

flat wind
#

--win-menu --win-dir-chooser

#

this should pop up menu and allow user to choose directory prior to installation

sacred dome
#

The background task is always only taking 1 MB of memory

flat wind
#

I would blame windows at this point

sacred dome
#

Okay things is getting out of hands

#

Why the hell is The installer running, but not shown in Task Manager

flat wind
#

get some sleep, restart pc and retry tomorrow

sacred dome
#

I can't even kill it

#

Okay it got back. Hell

flat wind
#

lets hope for the best this time
Touching wood

sacred dome
#

Spent more time packaging than the actual coding

#

When I saw the exe 5 hours ago with only JPackage, I thought it was easy

flat wind
#

Atleast you will be spending lesser time than I did for my first packaging 😭

sacred dome
flat wind
#

oh yeah oh_dear

sacred dome
#

So any suggestions on what to do before hopping off?

flat wind
#

maybe its better you hop off and let the pc get some rest too

sacred dome
#

Do I just hand people the fat jar and let them run it from the console 😭

flat wind
sacred dome
#

Dw I don't even know what that is to use it

#

All good

#

Packaging is new to me

flat wind
#

can I get the jar and I can try creating the executable for you?

sacred dome
#

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/

flat wind
#

target

#

app/libs just have a copy of the target's jar

sacred dome
#

ugh wait, The file is bigger than 10 MB

flat wind
#

I probably would have to get it from your github release

sacred dome
#

don't have nitro, let me put it on drive real quick

#

But wait aren't jars usually less than 0.5 MB?

flat wind
#

you can release the jar on github

sacred dome
#

Is it because it's fat?

flat wind
#

yep, FX has to be blamed for that

pulsar timberBOT
#

💤 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.

flat wind
#

still a problem exists, keep the thread alive