没有人会??那有人知道
NLS-SDK-2.1.0-Translations.zip能在什么地方下载到吗 ??
是elipse2.1的多国语言支持

解决方案 »

  1.   

    可能是少了:      writer.optimize();
          writer.close();
    因为没有对文件进行锁定。Eclipse中文语言包下载:http://download2.eclipse.org/downloads/drops/L-2.1.x%20Translations-200307021300/eclipse2.1.1-SDK-win-LanguagePackFeature.zip下面是lucene自己带的demo:class IndexFiles {
      public static void main(String[] args) {
        try {
          long starttime = System.currentTimeMillis();      IndexWriter writer = new IndexWriter("index", new StandardAnalyzer(), true);
          indexDocs(writer, new File(args[0]));
          writer.optimize();
          writer.close();
          System.out.print(System.currentTimeMillis() - starttime);
          System.out.println(" total milliseconds");    }
        catch (Exception e) {
          System.out.println(" caught a " + e.getClass() +
                             "\n with message: " + e.getMessage());
        }
      }  public static void indexDocs(IndexWriter writer, File file) throws Exception {
        if (file.isDirectory()) {
          String[] files = file.list();
          for (int i = 0; i < files.length; i++) {
            indexDocs(writer, new File(file, files[i]));
          }
        }
        else {
          System.out.println("adding " + file);
          writer.addDocument(FileDocument.Document(file));
        }
      }
    }