[英]Jar file - adding images to jar file
因此,我的 Jar 文件出現問題,找不到保存在圖形文件夾中的圖像,因此我將它們復制/粘貼到我的 UI 文件夾中,其中需要它們的類如下所示:
雖然這看起來很糟糕,但地球地圖圖像現在可以工作,但 loading8.gif 仍然無法工作。 它說它找不到文件。 這是代碼:
public LoadingLabel(){ loadingIcon = new ImageIcon(Objects.requireNonNull(getClass().getClassLoader().getResource("loading8.gif"))); }
為什么找不到文件? 我如何解決它 ?
檢查圖像的路徑。 希望圖像路徑配置正確。 如果您在一個地方復制圖像並且路徑指向不同的位置,那么您會看到此類問題。
[英]Adding images to a JAR file in Eclipse?
[英]Images not exporting to Jar file
[英]Load images in jar file
[英]Images will not work in a .jar file
[英]Accessing images in a .JAR file
[英]adding jar file dependencies
[英]Adding external jar dependency in JAR file
[英]Trouble deploying jar file with images
[英]Exporting Images with my JAR file
[英]Getting images from a .jar file
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.