[kepler-dev] file references inside jar files

Edward A Lee eal at eecs.berkeley.edu
Thu Aug 12 11:22:27 PDT 2004

Sorry, I thought you were doing this in Java code...

If I'm not mistaken, if you put the following into the
fileOrURL parameter:


where the path is relative to the classpath, then Java code that is
executed is essentially what I showed, which means it will find the
file whether it's in a jar or as a separate file on the local disk.


At 10:32 AM 9/12/2004 -0700, Dan Higgins wrote:
>Hi Edward
>I was trying to get a FileReader actor to find a file that exists only in 
>a jar file. The workflow worked fine when read from the file system if the 
>datafile is in the same directory as the workflow and there is only the 
>file name (no path needed). But if both are in a jar, the FileReader 
>cannot find the data file without the jar url syntax. Your example below 
>is java code (I believe) and it doesn't seem possible to just put it into 
>the fileOrUrl parameter of the FileReader. Or am I missing something?
>Edward A Lee wrote:
>>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:
>>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:
>>>A little long, but it seems to work!
>>>kepler-dev mailing list
>>>kepler-dev at ecoinformatics.org
>>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
>Dan Higgins                                  higgins at nceas.ucsb.edu
>http://www.nceas.ucsb.edu/    Ph: 805-892-2531
>National Center for Ecological Analysis and Synthesis (NCEAS) 735 State 
>Street - Room 205
>Santa Barbara, CA 93195

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