Reading a file path from xml path in a jar file



I have implemented a java program which runs fine. However, when I convert it to jar, it complains about the file path in a xml file.


I am using some external libraries and files. I specify the location of these files in a xml file. I use getClass().getResourceAsStream("xml file")); to load the xml file. However I have a path location mentioned inside the xml file where some external files are located. This location also has some sub folders. I tried placing them in the same directory as the source code, but it still complaints about the same.


How should I change the location in the xml file or where should I move the external file?


I have the following structure:



src
-main
--java
---package
----class file(source)
----xml file
----dict
-----unix
------All important files that need to be found


EDIT




XML file is as below:



<param name="file_manager"
value="net.didion.jwnl.dictionary.file_manager.FileManagerImpl">
<param name="file_type"
value="net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile" />
<param name="dictionary_path" value="dict/unix" />
</param>


The exception is:



Caused by: net.didion.jwnl.JWNLException: The properties file must specify a dictionary path

No comments:

Post a Comment