Menu

How to distribute the dictionary using JNLP

sffan
2005-01-27
2013-04-25
  • sffan

    sffan - 2005-01-27

    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

     
    • Komal

      Komal - 2005-12-08

      Instead of getResourceAsURI, use

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

      Then,
      create the Dictionary with

      new SpellDictionaryHashMap(new InputStreamReader(in));

       

Log in to post a comment.