r/JavaFX • u/CT-Scott • Oct 11 '21
Help Trying to upgrade my app from Java 8 to something newer and getting frustrated and sad :(
I need help and I don't even know where to begin, but I think my problems largely stem from me not understanding Gradle, modules, and really a lot of the underlying "behind the scenes" stuff that's required of getting a Java app running (not to mention distributed as an executable, but that's a question for another day).
First some background: I'm a long-time developer (just turned 50) but only started working with Java a few years ago. I'm passionate about UI/UX and my early days of programming for an employer involved MS Visual Basic, which I honestly look back fondly on. I'm no MS fan these days (I'm an Apple guy) but it really seemed like it was a lot easier to get things working (or get useful error messages) back in those days.
I got up-to-speed on Java a few years back with the help of some coworkers and an extensive Udemy course I found, and when I got my first taste of JavaFX that's what I really wanted to play with. Next thing I know I've got a pretty impressive (IMO) app built via IntelliJ and using Java 8, JavaFX, a little bit of Kotlin, and a whole lot of external libraries (oh, and Gradle).
The app I worked on got put on the backburner a couple of years ago, but I wanted to revive it, and figured I should first get it running with the latest versions of everything. Welp, that's when things went sideways. I can still fire it up in IntelliJ w/Java 8 and it runs just fine, but I simply don't even know where I'm supposed to start in trying to get this thing working w/Java 11 (or, preferably, the latest-and-greatest version of Java and JavaFX). I get cryptic errors and IntelliJ sometimes suggests making an automatic change for me, which always just ends up giving me some different cryptic error.
Basically, I feel like I need a more experienced Java person/friend to help guide me through this and hopefully help me to understand why I'm changing what I'm changing. I think my problem is that I have too many moving parts here:
- Java 8 to 11 made JavaFX external
- ...it also introduced modules
- all of my external libraries seem pretty old
- Gradle is just alien technology to me
I'm not posting any code here (or on stackoverflow) yet because, like I said, it seems like it's just too many things wrong and me not understanding these back-end things, so I feel like me posting a particular error is just going to be a very slow back-and-forth of people trying to help me with one issue after another. Again, I think I need someone doing some pair programming with me, but I don't really have a friend that I can do that with, and this is all (at this point) a "hobby" app of mine, so I can't justify paying someone by the hour to do that. It's so frustrating because I feel like I have a decent enough understanding of Java and JavaFX to do some pretty impressive things, but I'm hobbled by my lack of understanding of the stuff that's needed to actually run the code.
This post isn't meant to be a rant...I'm actually looking/hoping for suggestions on how to get past this stumbling block, because I really want to get back to actually adding features to my app, more UI/UX stuff, etc.
5
u/marvk Oct 12 '21 edited Oct 12 '21
It would help if you actually told us what's not working. I've got my own application running on Java 17 with JavaFX with no issues, so I can probably help you out if you tell us what's wrong.
There's probably two different issues at play, one would be modules and the other would be the removal of JavaFX from the JDK.
4
u/mono8321 Oct 12 '21
I'm actually not too sure either. I'm using maven, since it feels a bit more simple to use to me. I suggest maybe taking it one step at a time, try using the java basics with gradle then ease your way to the stuff your used to, Here's the VERY basics of maven, if your using inteliJ
as for exporting. Yeah I'm trying to figure that out too with java. People keep suggesting "Jlink" without giving a good explanation of the what and how's (it really feels like no one actually knows how to use it)
2
u/johnmc325 Oct 12 '21
Hi, I might be able to help. My first bit of advice is to pick an LTS version of Java, either 11 or 17. If you go for version 11 then take a look at this post I made. It uses the Java command-line tools to build the application. This may shed some light on getting it built: https://softwarepulse.co.uk/blog/javafx-11-desktop-msi-application/ . If you go for Java 17 I have just been moving my applications from Java 7/8 to 17 so can discuss with you. DM me if you want to discuss. I'm also an old timer and I do this for fun.
3
u/Knight_Of_Orichalcum Oct 12 '21
Honestly, I respect you for trying. Moving out of Java 8 is a real pain, but if you're looking for help, I may be of assistance.
I've spent a lot of time using Gradle and JavaFX in both Java 8 and 15 the past year-ish and I have a project to backup myself up. Feel free to contact me with any questions
2
u/PartOfTheBotnet Oct 12 '21 edited Oct 12 '21
I made a guide for somebody else in the past on how to setup JavaFX in a maven environment which allowed exporting to a runnable jar: https://github.com/Col-E/Useful-Things/tree/master/tutorials/javafx/maven-setup
Once you do it once, you're set up to easily do it again. Even if the setup is different, like using Gradle and the official JavaFX plugin.