[kepler-dev] file references inside jar files

Edward A Lee eal at eecs.berkeley.edu
Thu Aug 12 05:01:09 PDT 2004


I'm confused about why you would need to do this...
Given a file name relative to a classpath, the following pattern
will get it whether it's in a jar file or not:

target.getClass().getClassLoader().getResource(sourceFileName);


Edward


At 09:46 PM 8/11/2004 -0700, Dan Higgins wrote:
>Hi All,
>    One problem we have been having in the Java web start implementation 
> is how to reference data files that are only strored inside jar files. In 
> particular, when the BiodivFileExample is called from the index page, it 
> is loaded from a jar and the file it reads cannot be located. It looks 
> like a fix that avoid absolute path problems is to use a jar url. For 
> example, the data file that is in the kepler-configs.jar file can be 
> referenced as:
>
>jar:file:/ptII4.0.1/lib/kepler-configs.jar!/ptolemy/configs/kepler/workflows/eco/speciesCount.dat
>
>A little long, but it seems to work!
>
>Dan
>_______________________________________________
>kepler-dev mailing list
>kepler-dev at ecoinformatics.org
>http://www.ecoinformatics.org/mailman/listinfo/kepler-dev

------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal




More information about the Kepler-dev mailing list