简体   繁体   中英

"__ Cannot be resolved to a type" - JavaFX not working in eclipse with e(fx)clipse plugin

I am running Eclipse 2019-09 on Windows 10 and have installed e(fx)clipse and I have the javaFX sdk in C:/Program Files/Java/javafx-sdk-13.0.1 Whenever I create a new JavaFX project, the default code shows up, but everything (BorderPane, Stage, etc.) 'Cannot be resolved to a type'. How do I fix this?

所有 JavaFX 对象都标有红色下划线,在控制台的“问题”选项卡下,有 11 个警告说每个 JavaFX 对象“无法解析为类型”

May be you have to setting java build path.

follow this step.

right click your java project folder -> build path -> configure build path -> Libraries -> Modulepath -> add External Jar -> select jar file in javafx/lib. like that enter image description here

add and close;

and right click your java project folder -> run as -> run configure -> argument -> vm argument -> put this on the box --module-path "C:\\Users\\DELL\\Desktop\\Prog Math\\javafx-sdk-11.0.2\\lib" --add-modules javafx.controls,javafx.fxml enter image description here

in "" put location of your javafx\\lib that you add external jar;

Go to- eclipse -> menu -> Help -> Install New Software... then paste below link to install e(fx)clipse

e(fx)clipse - IDE - Updatesite - http://download.eclipse.org/efxclipse/updates-released/1.1.0/site/

Now, Add default external JAR jfxrt.jar in project using build path, given with Java from JDK installation directory.

C:\Program Files\Java\jdk1.8.0_281\jre\lib\ext\jfxrt.jar

If does not works on restarting eclipse then-

Go to- Project -> Build Path -> Configure Build Path -> JRE System Library -> Edit -> Change Execution Environment to JavaSE-1.8(jre) -> Apply

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM