{"record":{"id":"c465aa541ff53bd3","repo":"stanfordnlp/CoreNLP","slug":"java-io-ioexception-c465aa","errorCode":null,"errorMessage":"java.io.IOException","messagePattern":"java\\.io\\.IOException","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"critical","filePath":"src/edu/stanford/nlp/time/HeidelTimeKBPAnnotator.java","lineNumber":77,"sourceCode":"  }\n\n  public HeidelTimeKBPAnnotator(String name, Properties props) {\n    this.heideltimePath = new File(props.getProperty(HEIDELTIME_PATH_PROPERTY,\n            System.getProperty(\"heideltime\",\n                    DEFAULT_PATH)));\n    this.outputResults = Boolean.valueOf(props.getProperty(HEIDELTIME_OUTPUT_RESULTS, \"false\"));\n    this.language = props.getProperty(HEIDELTIME_LANGUAGE_PROPERTY, \"english\");\n//    this.tagList = Arrays.asList(props.getProperty(\"clean.xmltags\", \"\").toLowerCase().split(\"\\\\|\"))\n//        .stream().filter(x -> x.length() > 0)\n//        .collect(Collectors.toList());\n  }\n\n  @Override\n  public void annotate(Annotation annotation) {\n    try {\n      this.annotate((CoreMap)annotation);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e);\n    }\n  }\n  private static final Map<String, String> TRANSLATE = new HashMap<String, String>() {{\n    this.put(\"*NL*\", \"\\n\");\n  }};\n  public void annotate(CoreMap document) throws IOException {\n    try {\n\n      //--Create Input File\n      //(create file)\n      File inputFile = File.createTempFile(\"heideltime\", \".input\");\n      //(write to file)\n      PrintWriter inputWriter = new PrintWriter(inputFile);\n      prepareHeidelTimeInput(inputWriter, document);\n      inputWriter.close();\n      Optional<String> pubDate = getPubDate(document);\n\n      //--Build Command","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/HeidelTimeKBPAnnotator.java#L59-L95","documentation":"The Annotation-level HeidelTimeKBPAnnotator.annotate runs the internal CoreMap annotate, which performs I/O (temp file creation, launching the external heideltime.jar process). Any IOException is rethrown as a RuntimeIOException, so failures spawning/communicating with the external HeidelTime tool surface as this unchecked exception.","triggerScenarios":"Calling the heideltimekb annotator on an Annotation when: heideltime.path points to a directory without heideltime.jar or config.props (process fails to start), Java cannot create the temp input file, or the spawned HeidelTime process fails with an I/O error.","commonSituations":"Misconfigured 'heideltime.path' property (missing installation), heideltime.jar incompatible with the installed JDK, read-only temp directory, PATH lacking a usable 'java' executable.","solutions":["Set the 'heideltime.path' property (or -Dheideltime system property) to the directory containing heideltime.jar and config.props","Verify 'java -jar <path>/heideltime.jar' runs manually from the command line","Check the printed stack trace (the underlying IOException cause) to distinguish file-creation vs process-start failures","Ensure a Java runtime is on PATH and the temp directory (java.io.tmpdir) is writable"],"exampleFix":"// before\nprops.put(\"annotators\", \"tokenize,ssplit,pos,heideltimekb\");\n// after\nprops.setProperty(\"heideltime.path\", \"/opt/heideltime\");  // dir with heideltime.jar + config.props\nprops.put(\"annotators\", \"tokenize,ssplit,pos,heideltimekb\");","handlingStrategy":"try-catch","validationCode":"File dir = new File(props.getProperty(\"heideltime.path\", \"/u/roland/heideltime\"));\nif (!new File(dir, \"heideltime.jar\").canRead()) {\n    throw new IllegalStateException(\"heideltime.jar not found under \" + dir);\n}\nif (!new File(dir, \"config.props\").canRead()) {\n    throw new IllegalStateException(\"config.props not found under \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    pipeline.annotate(annotation);\n} catch (RuntimeIOException e) {\n    logger.severe(\"HeidelTime I/O failure: \" + e.getCause());\n    // degrade gracefully: continue without TimexAnnotations\n}","preventionTips":["Verify heideltime.path contains heideltime.jar and config.props before building the pipeline","Ensure 'java' is on PATH and compatible with heideltime.jar","Check java.io.tmpdir is writable","Run the external jar manually on a sample file after any environment change"],"tags":["java","nlp","io-exception","external-process"],"backgroundTag":"file-open-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}