У меня очень простой java код Lucene, который работает в моих друзьях P C, но он делает много ошибок для меня ... мы все используем Lucene 5.3.1, я думаю, что проблема в моем jdk11
package project;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.IntField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
public class Act1 {
public static void main(String[] args) throws
IOException {
Document doc = new Document();
Field titre = new TextField("Titre", "mon A staticestimation technique",Field.Store.YES);
Field ref = new IntField("Year", 2001,Field.Store.YES);
Field auteurs = new TextField("Auteurs","TaewhanKim, Ki-Seok Chung, C. L. Liu",Field.Store.YES);
doc.add(titre);
doc.add(ref);
doc.add(auteurs);
Path p = Paths.get("C:\\Users\\user\\Desktop\\abc");
Directory dir = FSDirectory.open(p);
StandardAnalyzer analyzer = new StandardAnalyzer();
IndexWriterConfig config = new IndexWriterConfig(analyzer);
IndexWriter index = new IndexWriter(dir, config);
index.addDocument(doc);
index.close();
}
}
но он делает эти ошибки
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.lucene.store.MMapDirectory$1 (file:/C:/Users/user/Downloads/lucene-5.3.1/core/lucene-core-5.3.1.jar) to method java.nio.DirectByteBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of org.apache.lucene.store.MMapDirectory$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.io.IOException: Unable to unmap the mapped buffer: MMapIndexInput(path="C:\Users\user\Desktop\abc\_1_Lucene50_0.doc")
at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:329)
at org.apache.lucene.store.ByteBufferIndexInput.freeBuffer(ByteBufferIndexInput.java:376)
at org.apache.lucene.store.ByteBufferIndexInput.close(ByteBufferIndexInput.java:355)
at org.apache.lucene.codecs.lucene50.Lucene50CompoundFormat.write(Lucene50CompoundFormat.java:92)
at org.apache.lucene.index.IndexWriter.createCompoundFile(IndexWriter.java:4680)
at org.apache.lucene.index.DocumentsWriterPerThread.sealFlushedSegment(DocumentsWriterPerThread.java:492)
at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:459)
at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:503)
at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:615)
at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:3121)
at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:3096)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1078)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1123)
at projet.Act1.main(Act1.java:31)
Caused by: java.lang.IllegalAccessException: class org.apache.lucene.store.MMapDirectory$2$1 cannot access class jdk.internal.ref.Cleaner (in module java.base) because module java.base does not export jdk.internal.ref to unnamed module @6e8dacdf
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
at java.base/java.lang.reflect.Method.invoke(Method.java:558)
at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:322)
at org.apache.lucene.store.MMapDirectory$2$1.run(MMapDirectory.java:314)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.apache.lucene.store.MMapDirectory$2.freeBuffer(MMapDirectory.java:314)
... 13 more
пожалуйста, помогите мне исправить эту проблему ... и, пожалуйста, если есть кто-нибудь, кто хорошо разбирается в java и Lucene, помогите мне У меня есть мини-проект java / Lucene, и из-за covid19 у нас не было никакого курса ... как видите, я даже не могу написать простой код