Javafx 是否正在FXML ImageView中加载图像?

Javafx 是否正在FXML ImageView中加载图像?,javafx,fxml,Javafx,Fxml,我的FXML中有以下图像: <ImageView> <image> <Image url="@/Icons/myImage.png" /> </image> </ImageView> 另一方面,我的图标在里面: src/Core/View src/Core/View/Icons 为什么我得到无效资源的错误。。。在类路径上

我的FXML中有以下图像:

        <ImageView>
            <image>
                <Image url="@/Icons/myImage.png" />
            </image>
        </ImageView>
另一方面,我的图标在里面:

src/Core/View
src/Core/View/Icons

为什么我得到无效资源的错误。。。在类路径上找不到?我不知道我做错了什么,也不知道如何使路径工作。

您需要将
url=“@/Icons/myImage.png”
更改为
url=“@Icons/myImage.png”
,删除首字母
/

忽略前面的
/
,即
@Icons/myImage.png