I am working on a simple program of JavaFX, HelloFX. I execute tasks like building or launching with ant. I have zero problems with that, it works perfectly so the code and the libraries are well linked in build.xml as you can see in the code.
But, VSCode does not find JavaFX and says 'import javafx cannot be resolved'. So I am wondering how does VSCode find Java dependencies? And how could he find the JavaFX one, As ant does? I thought that VSCode uses build.xml to find dependencies so, maybe I am wrong, or maybe my build.xml is bad.
Thank you in advance for your help!
<project name="HelloFX" basedir="." default="rebuild-run">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="/home/rafael/javafx-sdk-12.0.1/lib"/>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<property name="build.dir" value="bin"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="${ant.project.name}"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" modulepath="/home/rafael/javafx-sdk-12.0.1/lib">
<compilerarg line="--add-modules javafx.controls"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}" modulepath="/home/rafael/javafx-sdk-12.0.1/lib" >
<jvmarg line="--add-modules javafx.controls"/>
<sysproperty key="java.library.path" path="$(lib.dir)"/>
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<target name="rebuild" depends="clean,jar"/>
<target name="rebuild-run" depends="clean,run"/>