如果可能的话,我会做的是将图像与Jar一起打包。
这样,您不必担心Jar的发射位置。
然后,您将需要加载类似于以下内容的图像:
InputStream stream = this.getClass().getClassLoader(). getResourceAsStream("/images/logo.png");
如果可能的话,我会做的是将图像与Jar一起打包。
这样,您不必担心Jar的发射位置。
然后,您将需要加载类似于以下内容的图像:
InputStream stream = this.getClass().getClassLoader(). getResourceAsStream("/images/logo.png");