Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including external files in exported .jar?

 
Michael Keisu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I have had some problems when I have tried to export my game projects as a runnable .jar file in Eclipse, images and and none source files don't get included in the jar, so I had to place them outside (on the same level as the jar) to get it to work properly.
How do I fix this problem?

Mike
 
Stephan van Hulst
Bartender
Pie
Posts: 5813
61
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can create the jar file yourself using the jar tool that comes with the JDK. Then when you load the images, use Class.getResource() or Class.getResourceAsStream() to get access to them.
 
Michael Keisu
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I will look into them.
 
Phil Freihofner
Ranch Hand
Posts: 120
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I bookmarked this tutorial on "getResource" (about half way down the page) for myself. It's been helpful, as it includes several different scenarios.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic