Yao Lirong's Blog

Import Junit and JavaFx into VSCode

2019/11/21

The import javafx cannot be resolved

I have java 11 installed on my computer. JavaFx was not bundled with Java 11 so I have to first download it from here and put it at the same directory as Java jdk. But VScode still gives me the error “The import javafx cannot be resolved”. This was resolved after I ran Java: Clean the Java Language Server workspace, though I have no idea how VSCode magically found the directory of JavaFx.

The import Junit.Jupiter cannot be resolved

I downloaded Junit.Jupiter.api (the package I used for my tests) from here and put the jar file under workspace\lib. Then problem was solved. Tests are now runnable.

CATALOG
  1. 1. The import javafx cannot be resolved
  2. 2. The import Junit.Jupiter cannot be resolved