java.lang.OutOfMemoryError: Java heap space

Help
qhreul
2006-05-31
2013-04-29
  • qhreul
    qhreul
    2006-05-31

    Hi,
    I used the following method to create an hypernym path from a given node to the root node.

    /**
       * Function to check possibility to get a path from WordNET
       * @param w being the IndexWord looked @
       * @throws JWNLException
       */
        public void getHypernymPath(IndexWord w, String p) throws JWNLException {
            String path = p;
            PointerTargetNodeList hypernyms = PointerUtils.getInstance().getDirectHypernyms( w.getSense(1) );
            if ( hypernyms.size() > 0 ) {
                PointerTargetNode pointTgt = (PointerTargetNode) hypernyms.get(0);
                Word word = pointTgt.getSynset().getWord(0);
                String wStr = word.getLemma();
                path += wStr + " -> ";
                IndexWord childWord = dict.lookupIndexWord( POS.NOUN, wStr );
                getHypernymPath(childWord, path);
            } else {
                System.out.println("Path = " + path);
                return;
            }
        }
    This works properly except for creating an error memory.

    Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

    Has anyone got any idea how to solve this?