Hi,
I am using Jazzy API and english.0 file in my application. I get the dictionary file as a resource using,
private static createDictionary()
{
Application instance = new Application();
java.net.URI engUri = instance.getClass().getResource("/dict/english.0").toURI();
File englishDictFile = new File(engUri);
SpellDictionary engDictionary = new SpellDictionaryHashMap(englishDictFile);
JTextComponentSpellChecker spellCheckerComp = new JTextComponentSpellChecker(engDictionary, "Spell Check");
}
This workd fine on my desktop. When I create the jar file I include the dict folder which contains the dict file. I implement the application in Java Web Start using JNLP file. When I run the jnlp file, it throws,
NullPointerException, URI is not hierarchical.
Can sombody tell me why it is.
If I want to specify the dict file as a resource in my jnlp file, how do I do that. Thank you.
sffan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am using Jazzy API and english.0 file in my application. I get the dictionary file as a resource using,
private static createDictionary()
{
Application instance = new Application();
java.net.URI engUri = instance.getClass().getResource("/dict/english.0").toURI();
File englishDictFile = new File(engUri);
SpellDictionary engDictionary = new SpellDictionaryHashMap(englishDictFile);
JTextComponentSpellChecker spellCheckerComp = new JTextComponentSpellChecker(engDictionary, "Spell Check");
}
This workd fine on my desktop. When I create the jar file I include the dict folder which contains the dict file. I implement the application in Java Web Start using JNLP file. When I run the jnlp file, it throws,
NullPointerException, URI is not hierarchical.
Can sombody tell me why it is.
If I want to specify the dict file as a resource in my jnlp file, how do I do that. Thank you.
sffan
Instead of getResourceAsURI, use
InputStream in = instance.getClass().getResourceAsStream(dictFile);
Then,
create the Dictionary with
new SpellDictionaryHashMap(new InputStreamReader(in));