title: How to apply a patch to a Java project?
body: <p>The patch is for nutch 0.9:
  <a href="http://cvs.tty.org/~butch/blog/nutch_0.9_OR.patch" rel="noreferrer">http://cvs.tty.org/~butch/blog/nutch_0.9_OR.patch</a></p>
  
  <p>How should I apply the patch correctly?</p>
  
  <p>OS is windows XP</p>
  
  <p>More specifically, I'm using eclipse to debug a nutch project.</p>
  
  <p>Here is my trial:</p>
  
  <pre><code>D:\nutch-0.9.bak&gt;patch -p0 &lt; nutch_0.9_OR.patch
  Hmm...  Looks like an ed script to me...
  (Patch is indented 5 spaces.)
  The text leading up to this was:
  --------------------------
  |diff -rBNu src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java
  |--- src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java        2009-03-10 11:34:01.000000000 -0700
  |+++ src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java     2009-03-10 14:11:55.000000000 -0700
  |@@ -4,30 +4,34 @@
  | public interface NutchAnalysisConstants {
  |
  |   int EOF = 0;
  |-  int WORD = 1;
  |-  int ACRONYM = 2;
  |-  int SIGRAM = 3;
  |-  int IRREGULAR_WORD = 4;
  |-  int C_PLUS_PLUS = 5;
  |-  int C_SHARP = 6;
  |-  int PLUS = 7;
  |-  int MINUS = 8;
  |-  int QUOTE = 9;
  |-  int COLON = 10;
  |-  int SLASH = 11;
  |-  int DOT = 12;
  |-  int ATSIGN = 13;
  |-  int APOSTROPHE = 14;
  |-  int WHITE = 15;
  |-  int WORD_PUNCT = 16;
  |-  int LETTER = 17;
  |-  int CJK = 18;
  |-  int DIGIT = 19;
  |+  int QOR = 1;
  |+  int WORD = 2;
  |+  int ACRONYM = 3;
  |+  int SIGRAM = 4;
  |+  int IRREGULAR_WORD = 5;
  |+  int C_PLUS_PLUS = 6;
  |+  int C_SHARP = 7;
  |+  int PLUS = 8;
  |+  int MINUS = 9;
  |+  int QUOTE = 10;
  |+  int COLON = 11;
  |+  int SLASH = 12;
  |+  int LPAREN = 13;
  |+  int RPAREN = 14;
  |+  int DOT = 15;
  |+  int ATSIGN = 16;
  |+  int APOSTROPHE = 17;
  |+  int WHITE = 18;
  |+  int WORD_PUNCT = 19;
  |+  int LETTER = 20;
  |+  int CJK = 21;
  |+  int DIGIT = 22;
  |
  |   int DEFAULT = 0;
  |
  |   String[] tokenImage = {
  |     "&lt;EOF&gt;",
  |+    "\"OR\"",
  |     "&lt;WORD&gt;",
  |     "&lt;ACRONYM&gt;",
  |     "&lt;SIGRAM&gt;",
  |@@ -39,6 +43,8 @@
  |     "\"\\\"\"",
  |     "\":\"",
  |     "\"/\"",
  |+    "\"(\"",
  |+    "\")\"",
  |     "\".\"",
  |     "\"@\"",
  |     "\"\\\'\"",
  |diff -rBNu src.orig/java/org/apache/nutch/analysis/NutchAnalysis.java src/java/org/apache/nutch/analysis/NutchAnalysis.java
  |--- src.orig/java/org/apache/nutch/analysis/NutchAnalysis.java 2009-03-10 11:34:01.000000000 -0700
  |+++ src/java/org/apache/nutch/analysis/NutchAnalysis.java      2009-03-10 14:11:55.000000000 -0700
  |@@ -56,7 +56,11 @@
  |           queryString, (analyzer != null) ? analyzer : new NutchDocumentAnalyzer(conf));
  |     parser.queryString = queryString;
  |     parser.queryFilters = new QueryFilters(conf);
  |-    return parser.parse(conf);
  |+    try {
  |+      return parser.parse(conf);
  |+    } catch (ParseException pe) {
  |+      throw new IOException("Parse exception: " + pe);
  |+    }
  |   }
  |
  |   /** For debugging. */
  |@@ -77,44 +81,60 @@
  |   String field;
  |   boolean stop;
  |   boolean prohibited;
  |+  boolean required;
  |     nonOpOrTerm();
  |     label_1:
  --------------------------
  File to patch:
  </code></pre>