How to distribute the dictionary using JNLP

  • sffan

    sffan - 2005-01-27

            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(); 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.


    • Komal

      Komal - 2005-12-08

      Instead of getResourceAsURI, use

      InputStream in = instance.getClass().getResourceAsStream(dictFile);

      create the Dictionary with

      new SpellDictionaryHashMap(new InputStreamReader(in));


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks