• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including images and font

 
Dadaa Aressio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic