[英]getClass().getResource() returns null in deployment
當我從netbeans運行應用程序時,以下代碼運行良好
ThumbnailLabel lblImg =new ThumbnailLabel(new javax.swing.ImageIcon(
getClass().getResource("/jewelleryerpapplication/GUI/resources/NoPicture.png")));
然后我按照此問題的不同文章中所述清潔構建解決方案。之后,當我從dist文件夾雙擊App.jar時,會發生以下異常。
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
驗證您的部署JAR是否確實包含映像:-)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.