• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in running swings app from command line  RSS feed

 
Murali Jaya Rao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have developed swings application.In this i have a 3 packages(say 1,2,3).
In the 1st package i have written a bean class and ImageIcon classes for loading images and the code snippet is like

<code>
URL imageURL = Main.objEmptyClass.getClass().getResource("images/xyrBigImg.gif");
ImageIcon imageIconTempSens_Small = new ImageIcon(imageURL);
</code>
wherein object objEmptyclass is bean class.

Now my main class is in another 2nd package.I am instantiating the bean class and ImageIcon class also.

Now the problem is,whenn i try to run through netbeans the images are loading....
but when i execute jar file through command line or through doublle clicking
on the executable the imageUrl is becoming null.

can anyone please help regarding this scenario.

Thanks & Regards
Murali
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all its just Swing not Swings. As to your problem it is probably because the image resources are in the classpath in NetBeans but not included in the classpath when you are executing the code outside of NetBeans.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!