• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Icons and Images question

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope I'm in the right section,

Just want to know why my Frames and menuItem imageicons do not work when I put it in a jar file? Running the app outside of the jar, icons etc works fine.
Any help would be appreciated!
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://download.oracle.com/javase/tutorial/uiswing/components/icon.html#getresource

If that's not it, post a SSCCE that demonstrates your problem.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As another step I would also check that the image file is actually within the Jar.

I remember once having the same issue as yourself and I realised I forgot to include the file extension within my ant build file.
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys, thanks for the info, really appreciate it. One issue I have now... here is the code:



This works fine when I run it via a batch file, but when everything is in a .jar file, the program does not start up at all... I verified that all the images and classes are in the right place.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://download.oracle.com/javase/tutorial/deployment/jar/manifestindex.html

Again, if that's not it post a SSCCE. Also post the internal structure of the associated jar file.

edit

when everything is in a .jar file, the program does not start up at all


You need to tell us exactly how you attempted to run the program.
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a look at the link you gave me. I am sure that I did it right. The jar runs fine when I take the

code out. As I said, the app runs fine with the above code when I run it via command line, but not in jar. I have attached images of the jar contents aswell as the app directory and contents of the manifest file. The code I use to compile my jar file is: jar cvfm NetChatClient.jar manifest.txt *.class img/*.*
client.PNG
[Thumbnail for client.PNG]
jar.PNG
[Thumbnail for jar.PNG]
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OH MY WORD guys, I found the problem. I'm sorry for this whole discussion, I feel like such an idiot now. The problem was that I used dir//file instead of dir/file in my URLs. Sorry again... Please close this thread, thanks.
 
Arthur, where are your pants? Check under this tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic