title: Unable to resolve "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz" as either class path, filename or URL
body: <p>I have the same question that was posted 2 years ago here: </p>
  
  <p><a href="https://stackoverflow.com/questions/16523067/how-to-use-stanford-parser">How to use Stanford parser</a></p>
  
  <p>On that page, SahelSoft says they found an answer: </p>
  
  <p>"I solved this problem. The problem was the conflict between stanford parser package and stanford coreNLP package in my workspace."</p>
  
  <p>They don't really say what the answer is. I am new to Java and I trouble figuring out what it would mean to have a conflict between 2 packages. Can anyone offer any enlightenment? </p>
  
  <p>The actual error looks like this: </p>
  
  <pre><code>Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz" as either class path, filename or URL
  at 
      edu.stanford.nlp.parser.common.ParserGrammar.loadModel(ParserGrammar.java:183)
  
  at edu.stanford.nlp.pipeline.ParserAnnotator.loadModel(ParserAnnotator.java:197)
  
  at edu.stanford.nlp.pipeline.ParserAnnotator.&lt;init&gt;(ParserAnnotator.java:107)
  
  at edu.stanford.nlp.pipeline.AnnotatorImplementations.parse(AnnotatorImplementations.java:145)
  
  at edu.stanford.nlp.pipeline.AnnotatorFactories$11.create(AnnotatorFactories.java:453)
  
  at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85)
  
  at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:289)
  
  at edu.stanford.nlp.pipeline.StanfordCoreNLP.&lt;init&gt;(StanfordCoreNLP.java:126)
  
  at edu.stanford.nlp.pipeline.StanfordCoreNLP.&lt;init&gt;(StanfordCoreNLP.java:122)
  
  at com.rollioapp.nlp.Main.main(Main.java:53)
  </code></pre>
  
  <p>Caused by: java.io.IOException: Unable to resolve "edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz" as either class path, filename or URL</p>
  
  <pre><code>at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:481)
  
  at edu.stanford.nlp.io.IOUtils.readObjectFromURLOrClasspathOrFileSystem(IOUtils.java:313)
  
  at edu.stanford.nlp.parser.common.ParserGrammar.loadModel(ParserGrammar.java:180)
  </code></pre>
  
  <p>The import statements at the top of the file look like this: </p>
  
  <pre><code>package com.ollio.nlp;
  
  import edu.stanford.nlp.ie.AbstractSequenceClassifier;
  import edu.stanford.nlp.ie.crf.CRFClassifier;
  import edu.stanford.nlp.ling.CoreAnnotations;
  import edu.stanford.nlp.ling.CoreAnnotations.*;
  import edu.stanford.nlp.ling.CoreLabel;
  import edu.stanford.nlp.parser.lexparser.LexicalizedParser;
  import edu.stanford.nlp.parser.lexparser.Options;
  import edu.stanford.nlp.pipeline.Annotation;
  import edu.stanford.nlp.pipeline.StanfordCoreNLP;
  
  import edu.stanford.nlp.process.Tokenizer;
  import edu.stanford.nlp.semgraph.SemanticGraph;
  import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;
  import edu.stanford.nlp.trees.Tree;
  import edu.stanford.nlp.trees.TreeCoreAnnotations;
  import edu.stanford.nlp.util.CoreMap;
  import edu.stanford.nlp.util.StringUtils;
  import jdk.internal.org.xml.sax.InputSource;
  
  import javax.swing.text.Document;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import java.io.*;
  import java.util.*;
  import java.util.ArrayList;
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  import java.lang.System.*;
  </code></pre>