This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading file from jar file

 
Gail Mikels
Ranch Hand
Posts: 634
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to read a file that I'm using as a template. The template file is in the deployed jar file for my application. I'm thinking my syntax for reading a file from a jar file is incorrect, though I've tried several examples I've found, and none seem to work.

Here's my code snippet:




And here's the relevent output & error:



I've searched online & it seems that I'm doing it right. But obviously I'm not! I've tried making the slashes go the other way, tried finding other files in that same directory (also unsuccessful), opened up my jar file to verify that my template file is at the path I'm looking at. To no avail.

Any ideas?? :-)
 
Paul Clapham
Sheriff
Pie
Posts: 20183
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resources inside jar files aren't "files". Only things on disks that your operating system manages as files are "files". So you can't use a FileInputStream. Do this instead:
 
Gail Mikels
Ranch Hand
Posts: 634
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh. <duh>

Thank you very much!!! :-D
 
Arvind Subramanian
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thannks very much... the exact answer which i confused...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic