#java fx installation errors
1 messages · Page 1 of 1 (latest)
<@&987246487241105418> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
I followed this tutorial: https://www.youtube.com/watch?v=_7OM-cMYWbQ
Setting up JavaFX for Eclipse is a pain in the ass
- (00:00:35) Download JavaFX SDK
- (00:01:59) Install JavaFX plugin
- (00:02:31) Create a new JavaFX project
- (00:03:47) Create user library
- (00:04:40) Set user library
- (00:05:02) Configure build path
- (00:05:36) Add VM arguments
Linux/Mac: --module-path /pat...
tried having a look in your build path jar's to see that there is no duplicate ?
I kinda fixed it
but theres still an issue
Multiple markers at this line
- The method getStylesheets() from the type Scene refers to the missing type String
- The method getClass() is undefined for the type Main
- The type java.lang.String cannot be resolved. It is indirectly referenced from required type javafx.application.Application
what is it
stdlib = standard library
ah. yeah its unbound
you need to bind it to your installed jre
if you press Edit on it, you should be able to bind it
you shouldn't install it but rather use maven or gradle
I will try soon
What's that?
Im a bit ignorant on the subject
build tools/dependency managers
they will automatically download libs or other dependencies, install them, build your program, package it, and run it
Is there any tutorial for that?
google it I guess
I can help you with maven tho
it works, but I also get this issue:
Error: Could not find or load main class application.Main
Caused by: java.lang.ClassNotFoundException: application.Main
can u help me with this error?
are you using maven or gradle ?
none of them
because I already have java fx installed
Did you set VM arguments?
the whats?
To run a JavaFX application you need to set some VM arguments, to do so you need to paste them into the run configuration (it's called like this in Eclipse, idk which IDE you are using)
Im using Eclipse
how do I do that?
I set java fx as in the module and classpath tho
from this open "run configurations"
Then create one run configuration for your project/edit the one you already have
and under "VM arguments" write that: --module-path "paste here JavaFX/lib directory" --add-modules javafx.controls
ah yes, it doesnt have a module anymore..
do I have to add one?
Did you create a user library?
yes
Ok then add the user library to your project and put these arguments
Remove JavaFX from modulepath
You need to set the correct JavaFX directory and select the folder called "lib"
k, then
oh u mean
the folder
Like "C:\something\lib"
ahh yes
example
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\Andrew\Desktop\programs\javafx-sdk-20.0.1\lib\javafx.base.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 61.0
Wait are you using JavaFX version 20.0.1 with Java 17?
need to up your pc's java for that
it says unbound till java 14
I meant
all the versions above it are unbound
so im using java fx 20 with java 14
is that all right?
JavaFX 20 is designed to work with JDK 20, but it is known to work with JDK 17 and later versions.
from their site
use alterernate and point it towards the correct one
most likely your installation comes with java till 14 , and the rest is not bound to eclipse
no, point it towards the installed one
Just install a newer version of Java and add the buildpath on eclipse
Then change the compilance level
could try adoptium, https://adoptium.net/temurin/releases/?version=20
( its got other versions aswell , its just a quick grab link )
expand javaFx
Under module path do add library -> JRE System Library
drop to lib\
same issue
Btw that's java 8
u sure?
1.8 is 8
u need the jdk
Wait your goal here is to get a newer version of java
from java 12 (i think, maybe 11?) there isn't a jre and a jdk, there is only the jdk
thats why
If you have already installed JavaFX 20.0.1 get the same java version
You can either install it from oracle site or from openjdk (that's better so you don't have licensing problems)
ok it works but
Error: Could not find or load main class application.Main
Caused by: java.lang.ClassNotFoundException: application.Main
Now you need VM arguments
of java fx or jdk?
--add-modules javafx.controls```
I used this: --module-path C:\Users\Andrew\Desktop\programs\javafx-sdk-20.0.1\lib --add-modules javafx.controls
and I still get the same error
Send a screenshot
and the Main tab ?
What's that warning?
nothing important, java fx import is never used
that seems odd
Have you launched that project with this run configuration?
yes
Error: Could not find or load main class application.Main
Caused by: java.lang.ClassNotFoundException: application.Main
just to avoid some shenaningans, restart eclipse
k
I installed e(fx)
not the question, did u type that import or did eclipse add it ?
so u typed it, then u can erase it
I don't think that's the case 'cause there aren't spaces in your path, but try to put " before and after JavaFX's path
same thing
maybe its not related to VM
maybe its because java fx isnt in the module path
No that's the classic error that you get when you don't put correct VM arguments
ye
--module-path "C:\Users\Andrew\Desktop\programs\javafx-sdk-20.0.1\lib"
--add-modules javafx.controls
from where does the new line come ?
which one
I think its an enter
yeah a new line
yeah
remove it
still same issue
wonder if its problem due to windows cheating on paths
your fx lib is on your desktop ?
in a desktop folder
If you paste "C:\Users\Andrew\Desktop\programs\javafx-sdk-20.0.1\lib" in your source explorer you get to the correct folder?
without the "" yes
"Error: Could not find or load main class application.Main
Caused by: java.lang.ClassNotFoundException: application.Main
"
just to rule something out, share your code screen
try refactoring the class to avoid confusion
the name?
the class name
same thing
can u share an updated shot ?
In src there is package named "application" i think
and Main is a class in that package
Tbh i don't know why it doesn't work, with the correct version of java, the user library and VM arguments it should work
theres another one that can interfere, if he placed it on the desktop
onedrive
@mint mirage what happens when u right click on the class with the main method ( on the left side window ) and run it from the popup ?
I will tell u tomorrow, gtg now