• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Including images and font

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I'm trying to include some resources (images and fonts) in my project. As of now is works if I run the project from Eclipse or if I export a runnable jar via Eclipse (all files in one jar). But if I build my project with ant it doesn't work.

Here is the addImage method:

which I call like this:


Here is the setFont method:

which I call like this:


And finally here is my build.xml:


Can anyone point out what I'm doing wrong?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see anything in your Ant code which writes images and fonts into the jar. Actually I don't even see anything there which writes java classes into the jar. Perhaps it's that "sonar" which is supposed to do those things? If so, you should look and see what it is doing and how it does it.

(Let me move this to our forum where Ant questions are asked, perhaps it will get better answers there.)
 
Dadaa Aressio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok so I changed the prepare task in the build.xml like this:

And it works as expected. It seems a bit bulky so now I'm wondering if it is the correct way of doing it. Again thanks
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me that you would have to do something extra to copy the resources into the build directory, I don't see why it should happen automatically. And what you posted does that. However I would put the actual copying of the resources into the "compile" target rather than the "prepare" target.
 
Dadaa Aressio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:It seems to me that you would have to do something extra to copy the resources into the build directory, I don't see why it should happen automatically. And what you posted does that. However I would put the actual copying of the resources into the "compile" target rather than the "prepare" target.


Thanks for the advice
 
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
Dadaa, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/62722-including-images-font.html
 
Dadaa Aressio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote:Dadaa, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/62722-including-images-font.html


I know it can be frustrating, and I am aware of that. I did so only because I wasted an hour on a couple IRC channels without getting an answer and wanted to maximize my chance of getting an answer. As you might notice I kept all three (you missed this) threads updated as not to leave hanging threads.
I hope you understand.

PS. I wont copy this answer to the other forum you moderate in, as far as I'm concerned you can mark as solved and close both threads you have power over. Thanks and sorry again
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic