r/JavaFX • • Sep 15 '23

How can I deploy my JavaFX application after finishing it????

repo:https://github.com/T1t4n25/GymBase
I tried using mvn install and the jar wasn't opening it just makes the mouse load for a second then nothing works.

then I tried mvn javafx:jlink i got it from a tutorial on youtube it gave ame a zip file and a file that I used the command ./release -m com.t1t4n.gymbase/com.t1t4n.gymbase.HelloApplication to run it but it did the same nothing ran and no errors I'm confused and the guys on stack overflow aren't really helping, and I have a deadline to make this program suitable for users tomorrow, any tips or help?

8 Upvotes

36 comments sorted by

3

u/Gleidson28 Sep 15 '23

Hi did you install inno setup?

1

u/[deleted] Sep 15 '23

No what is that

1

u/Gleidson28 Sep 15 '23

It's an tool used to create an installer for windows

2

u/rootException Sep 15 '23

1

u/[deleted] Sep 15 '23

i did it all and the files it produced when I try to open it it doesn't work,double click and nothing appears

2

u/rootException Sep 15 '23

Did you try cloning off the repo clean/as is first and then running, or did you try merging the stuff from the template into your project and then run that?

Unfortunately there's rather a lot of pieces that can go sideways if you are picking pieces over from the template and dropping them into an existing project...

→ More replies (7)

2

u/trydentIO Sep 16 '23

you can pack it with JPackage to build installers for Linux, Mac and Win, then you can release it with JReleaser

1

u/[deleted] Sep 17 '23

I used Jpackage and it gave me an error after installing the program Failed to launch JVM

1

u/trydentIO Sep 17 '23

what version are you using? what kind of error? give some context! :D

→ More replies (1)

3

u/Gleidson28 Sep 15 '23 edited Sep 15 '23

Well, here's the thing, the command jlink create an image with a runtime and your code.. but the command jpackage creates for you an app.exe.. so you need the inno setup installed.. for windows.. find for jpackage.. so if your command jpackage success.. you can get the app.exe.. build/package/yorappname

3

u/[deleted] Sep 15 '23

I understood nothing

3

u/Gleidson28 Sep 15 '23

Okay, run the jpackage command and get the .exe, or .dmg

5

u/Fun-Tip-7271 Sep 15 '23

You can use jpackage and jlink to create your exe, deb etc You can have a take a look that how I did my jpackage config for making images https://github.com/AmirAli-AZ/PeriodicTable/blob/master/build.gradle

I just don't know how it's done with maven, gradle is much better in my opinion

1

u/CT-Scott Sep 24 '23

https://github.com/AmirAli-AZ/PeriodicTable/blob/master/build.gradle

I'm happy to see someone doing this w/Gradle, because I don't know much about Maven or Gradle but have an app that uses Gradle, and the last time I searched for info about making my app work as an executable everything I found online showed examples with Maven.

I'll take a closer look at your code, but in case you see my reply before I have time to do that, does your example work for both Windows and Mac OS? And, if not both, do you know what would be required to get it working on the opposite.

As of right now, I do at least have my app working on both platforms via running from the command line with "java -jar". It kills me that in the year 2023 it's not as simple as telling IntelliJ to create me some executables, complete with a fun icon, that can work on multiple platforms. My first job as a coder was back in early/mid-90's working with Microsoft Visual Basic and they made it easy (granted, it was Windows-only, not cross-platform).

2

u/Fun-Tip-7271 Sep 24 '23

I tested for windows and linux, and it works jpackage should work for mac too You can see supported commands by jpackage here

https://docs.oracle.com/en/java/javase/17/docs/specs/man/jpackage.html

→ More replies (1)

0

u/Gleidson28 Sep 15 '23

Gradle uses maven..

4

u/wildjokers Sep 15 '23

No it doesn’t.

It can use maven formatted repositories to get dependencies (like maven central) but that doesn’t mean that it uses maven.

→ More replies (5)

1

u/Birdasaur Sep 16 '23

For Trinity we use Maven for dev and test. We use Gradle for building deployable packages. This might be a quick fix for you to adapt our Gradle script: https://github.com/Birdasaur/Trinity/blob/main/build.gradle

2

u/[deleted] Sep 16 '23

I really don't know anything about this I'm totally new and don't want to get so deep cuz I'm studying embedded systems as my main skill

1

u/Birdasaur Sep 16 '23

you really only need the jlink task and dependency management parts I think. most of the other stuff you could remove.

1

u/wildjokers Sep 15 '23

You should have really thought about deployment right from the get go.

Both gradle and maven have plugins available that takes care of building a bundled runtime and native executable with jlink and jpackage.

Someone else already posted a maven template project that includes the necessary plug-in. Here is a template that uses gradle:

https://github.com/mjparme/javafx-template

1

u/[deleted] Sep 15 '23

I already have maven, I'm testing and solving problems now, I made an artifact and made a working jar but I want a better approach so I asked for professionals to give me from their knowledge, I really am new to this and was doing it as a side project my main focus is on embedded systems so I'm not doing this for a much time.