更新时间:2023-09-30 13:08:10
您需要从类路径而不是从本地磁盘文件系统获取它.
You need to get it from the classpath instead of from the local disk file system.
假设 images
实际上是一个包,并且这个包与当前类在同一个 JAR 中,那么这样做:
Assuming that images
is actually a package and that this package is inside the same JAR as the current class, then do so:
final public ImageIcon iReport =
new ImageIcon(getClass().getResource("/images/Report.png"));