Re: Incorporating data files into packages and accessing internally



On Tue, 31 Jul 2007 13:42:56 -0700, Todd <todd.heidenthal@xxxxxxxx>
wrote, quoted or indirectly quoted someone who said :


Furthermore, I would like to be able to open and read the contents of
the data files within the package without having to know its path on
the disk. I would like to think that I can access a data file within
a package in a manner similar to accessing another class in the
package. If so, how do I do this?

there are several ways to skin that cat.

1. put the data in resource, usually gzipped in the jar. See
http://mindprod.com/jgloss/ant.html
http://mindprod.com/jgloss/genjar.html
http://mindprod.com/jgloss/resource.html
http://mindprod.com/jgloss/image.html
This is the usual way. Have a look at:
http://mindprod.com/products1.html#BIO includes two images in the jar
as resources.
http://mindprod.com/products1.html#HOLIDAYS includes a text properties
file in the jar.

2. massage the data so it looks like java source code, eg. an array
initialisation, a long hex string, and insert it into a class file.
I do this with http://mindprod.com/products.html#ENTITY

3. Use Cramfull. http://mindprod.com/jgloss/cramfull.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.



Relevant Pages

  • Re: Data as Scripts and [package require]
    ... % package require -exact simulator 2.0 ... IMHO data files should contain data, ... Process the file by some common routine until the `version' is known, ...
    (comp.lang.tcl)
  • RE: word 2007 wont reg key
    ... number on the installation disk included in the package of items with the ... but when i copied some old data files into word 2007 ... able to get automatic window updates though. ...
    (microsoft.public.word.docmanagement)
  • Re: Incorporating data files into packages and accessing internally
    ... the data files within the package without having to know its path on ... When your data is located inside the jar that also contains your ... a package in a manner similar to accessing another class in the ...
    (comp.lang.java.programmer)
  • Incorporating data files into packages and accessing internally
    ... What I want to do is include the coastal data files into the package ... the data is included with the jar. ... a package in a manner similar to accessing another class in the ...
    (comp.lang.java.programmer)
  • Packaging Tcl/Tk Application on Windows: Single File Executable
    ... I need to package application developed in Tcl/Tk on Windows. ... be a single file executable with all data files, dependency ... There should be not reference to external data files such as images .. ... All should be bundled as a single file on desktop. ...
    (comp.lang.tcl)