Why cannot run compiled JavaFX 11 class?

Murray Eisenberg murray at math.umass.edu
Tue Oct 30 21:05:46 UTC 2018


This is under macOS Mojave (10.14).

Following instructions at https://openjfx.io/openjfx-docs/#install-javafx, I compiled the sample HelloFX.java via:

     javac --module-path $PATH_TO_FX --add-modules=javafx.controls /Users/me/Documents/java/HelloFX.java 

But now if I attempt to run that...

     java --module-path $PATH_TO_FX --add-modules=javafx.controls /Users/me/Documents/java/HelloFX

... I get error:

     Error: Could not find or load main class .Users.me.Documents.java.HelloFX
     Caused by: java.lang.ClassNotFoundException: /Users/me/Documents/java/HelloFX 

Yet the file reported as not found is there:

     ls -l /Users/me/Documents/java/HelloFX.class
     -rwxr--r--  1 me  staff  1336 Oct 30 16:01 /Users/murray/Documents/java/HelloFX.class

(I had already changed permissions to add `u+x` in case that was the issue, but apparently that was not the trouble.

What's wrong?

(Yes, `$PATH_TO_FX` does point to `javafx-sdk-11/lib`.)

——
Murray Eisenberg                                murray at math.umass.edu
Mathematics & Statistics Dept.       
University of Massachusetts Amherst              






More information about the openjfx-dev mailing list