r/JavaFX • • Jun 01 '23

Help JavaFX for free software development

I'm trying to learn how to use JavaFX to develop "free" cross-platform software.

By cross-platform I mean both mobile and desktop. Java is a natural choice because its original design goal was "write once, run anywhere" and it it now widely used on mobile, desktop and server platforms. JavaFX is a natural choice for an application framework because it is able to target all those platforms.

My idea of "free" includes being able to build software using command line tools that are themselves free software. Ideally I want to be able to use a script invoking javac, jar, dx, aapt and other low-level tools to build an application. Some of the Java IDEs are nominally free software, but they are so huge that the programmer can never really understand what they are doing. Likewise, many build examples on the web show a command line that invokes gradlew, which in turn downloads gradle, which in turn implements recipes that the developer knows nothing about. I'm not dead set against using an IDE like Eclipse that hides many details from programmer, but I do not want to be dependent on a huge IDE that produces an application package by a process that is essentially magic.

The big stumbling block in implementing this concept of "free" cross-platform is the Android implementation of JavaFX. I admire and salute Gluon for supporting the continuing existence of JavaFX on Android. But most of their examples use their proprietary "compile to native code" tools. No doubt there's a big performance advantage for that approach. But I so far have not found a clear example, reasonably current, showing how to build and run a JavaFX "Hello World" using just low-level free tools.

Comments or suggestions would be welcome.

4 Upvotes

27 comments sorted by

View all comments

Show parent comment

5

u/hamsterrage1 Jun 03 '23

Kotlin runs in the JVM, so it's every bit as portable as Java. Additionally, Kotlin also has the option of running native and will also compile to JavaScript.

As for Debian, my daily use system is Ubuntu and I also have a laptop running Manjaro. Both of these run IDE's like Idea and VSCode, and have no problem compiling or running Kotlin.

Don't forget that Android is limited to a fairly old version of Java - 8, I think - and since Google has embraced Kotlin you should not expect that to change. So Java on Android is already today's, "obsolete".

As to free, I don't get your point. Post your source code in GitHub, as I do, and include a build.gradle file. Others can download it and run the Gradle build if they like. Or use it to create a Maven POM file. Or build manually. It makes no difference to the free-ness of the code.

However, having a build script or POM file does help as it specifies the dependencies down to the version level (not to mention downloading the automatically), which is information you would otherwise have to include with your source code.

Most importantly though, is that programmers wanting to modify your project are probably not going to share your desire to avoid using modern tools to edit and compile your project. So they're going to use an IDE and build engine and won't care that you don't - other than to be annoyed at you for not including a POM file, or build.gradle file.