0

I know this is often a common issue but the Java 8 aspect confuses me. I'm aware that since Oracle removed JavaFX from the Java distribution, this issue is usually resolved with VM arguments (--module-path,--add-modules, etc).

However, I'm exporting a .jar file using jre 1.8.0_202 in eclipse. And this works great without any arguments on my windows machine. Sadly when I move this jar to my linux machine, I see the classic "Cloud not find or load main class". For reference, the linux machine is running 1.8.0_342. I would think that this shouldn't be an issue because I'm using older Java versions?

Any insight on why this works on one platform and not the other?

M. Rogers
  • 367
  • 4
  • 18
  • 1
    are you using the same command on windows and linux to run this? – f1sh Jan 09 '23 at 16:45
  • Yes, "java -jar T.jar" – M. Rogers Jan 09 '23 at 16:59
  • 3
    JavaFX was never included in the Linux JRE, if I remember correctly – James_D Jan 09 '23 at 17:11
  • What is the value of the `Main-Class` attribute in the manifest? What happens when you recompile? Oracle's Java SE Development Kit 8u351 is current; I've experienced regressions in prior versions; I see that several Linux architectures are supported, but I haven't tried any; on macOS, the SDK has included JavaFX for over a decade. – trashgod Jan 09 '23 at 18:39
  • Main-Class is "application.Main" which is what I expect it to be – M. Rogers Jan 09 '23 at 18:44
  • 2
    Oracle JDK 8 for Linux includes JavaFX, you could use that to run a JavaFX 8 application jar file. Most OpenJDK 8 distributions for Linux do not include JavaFX 8, though some allow you to add JavaFX (for example [in debian](https://stackoverflow.com/a/35956637/1155209)). In general, it is probably better to switch to a modern JDK/JavaFX version (19+) and a different packaging solution (jlink or jpackage). – jewelsea Jan 09 '23 at 20:18
  • 1
    I had javafx on java 8 on linux ubuntu 64 14.04 . no extra libs needed – Giovanni Contreras Jan 09 '23 at 21:51
  • First it should be clarified that `javafx` is part of `java 8` platform **only** in oracle version. Second, the `ubuntu` repositories have `openjdk` which, despite being version 8, does **not include** javafx. Your post is missing information about exactly what platform you are using (just the version is not enough). – mr mcwolf Jan 10 '23 at 06:30

0 Answers0