You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Adrien Grand <jp...@gmail.com> on 2017/12/04 13:48:18 UTC

Re: how to compile lucene 4.10.4 using jdk7

I suspect you are not using the version you think you are using at compile
time, this error message suggests that you are actually compiling with Java
9. See this email thread which has a bit more information about this issue:
http://mail-archives.apache.org/mod_mbox/lucene-dev/201503.mbox/%3C07c401d06aba$0b477c80$21d67580$@thetaphi.de%3E
.

Le ven. 24 nov. 2017 à 15:28, Yonghui Zhao <zh...@gmail.com> a écrit :

> Hi,
>
> I clone lucene 4.10.4 tag from github and use ant to build.
>
> My ant and local jdk in mac info:
>
> *Apache Ant(TM) version 1.9.9 compiled on February 2 2017*
> *Trying the default build file: build.xml*
> *Buildfile: /Users/yozhao/src/lucene-solr/lucene/core/build.xml*
> *Detected Java version: 1.7 in:
> /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre*
> *Detected OS: Mac OS X*
>
>
> I use simple one word "ant" command to build the jar, and copy the jar to
> my Centos server.
> Jdk in the server is 1.7.0_67
>
>
> But when I start my service, exception thrown
>
>  20 Exception in thread "main" java.lang.NoSuchMethodError:
> java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
>  21   at
>
> org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.<init>(ByteBufferIndexInput.java:418)
>  22   at
>
> org.apache.lucene.store.ByteBufferIndexInput.newInstance(ByteBufferIndexInput.java:55)
>  23   at
> org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:199)
>  24   at
>
> org.apache.lucene.store.NRTCachingDirectory.openInput(NRTCachingDirectory.java:198)
>  25   at
> org.apache.lucene.store.Directory.openChecksumInput(Directory.java:113)
>  26   at
>
> org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:836)
>  27   at
>
> org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:769)
>
>
>
> This should be some issue with jdk version. I compile in 1.7.0_45 and run
> in 1.7.0_67 why can this happen?
>