Mailing List Archive

Help running the demo program
Hello,

I am a new user to Lucene. I checked out the Lucene repo
<https://github.com/apache/lucene/tree/releases/lucene/9.10.0> and synced
to releases/lucene/9.10.0 tag. From there I have run following commands:

./gradlew
./gradlew assemble

I would now like to run the demo program. How can I do that? I see some
class files under lucene/demo/build/classes/java/main but how do I build
the full classpath with all the dependencies needed to run the demo
program? Can anyone help me? Thanks,

S.
Re: Help running the demo program [ In reply to ]
Hi Siddharth,

If you happen to be using IntelliJ, you can run a demo class from the IDE.
It probably works with other IDEs too, though I haven't tried it.


Stefan

On Sun, 21 Apr 2024 at 23:59, Siddharth Jain <siddhsql@gmail.com> wrote:

> Hello,
>
> I am a new user to Lucene. I checked out the Lucene repo
> <https://github.com/apache/lucene/tree/releases/lucene/9.10.0> and synced
> to releases/lucene/9.10.0 tag. From there I have run following commands:
>
> ./gradlew
> ./gradlew assemble
>
> I would now like to run the demo program. How can I do that? I see some
> class files under lucene/demo/build/classes/java/main but how do I build
> the full classpath with all the dependencies needed to run the demo
> program? Can anyone help me? Thanks,
>
> S.
>
Re: Help running the demo program [ In reply to ]
I also found this helpful documentation by looking in the source code
of SearchFiles.java: https://lucene.apache.org/core/9_10_0/demo/

On Mon, Apr 22, 2024 at 4:40?AM Stefan Vodita <stefan.vodita@gmail.com> wrote:
>
> Hi Siddharth,
>
> If you happen to be using IntelliJ, you can run a demo class from the IDE.
> It probably works with other IDEs too, though I haven't tried it.
>
>
> Stefan
>
> On Sun, 21 Apr 2024 at 23:59, Siddharth Jain <siddhsql@gmail.com> wrote:
>
> > Hello,
> >
> > I am a new user to Lucene. I checked out the Lucene repo
> > <https://github.com/apache/lucene/tree/releases/lucene/9.10.0> and synced
> > to releases/lucene/9.10.0 tag. From there I have run following commands:
> >
> > ./gradlew
> > ./gradlew assemble
> >
> > I would now like to run the demo program. How can I do that? I see some
> > class files under lucene/demo/build/classes/java/main but how do I build
> > the full classpath with all the dependencies needed to run the demo
> > program? Can anyone help me? Thanks,
> >
> > S.
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Help running the demo program [ In reply to ]
Thanks Michael. I did add all the 4 modules to my classpath like this:

java \
-cp
$CWD/demo/build/classes/java/main:$CWD/analysis/common/build/classes/java/main:$CWD/queryparser/build/classes/java/main:$CWD/core/build/classes/java/main
\
org.apache.lucene.demo.IndexFiles \
-docs $DOCS_DIR

but get this error:

Indexing to directory 'index'...
Exception in thread "main" java.lang.LinkageError:
MemorySegmentIndexInputProvider is missing in Lucene JAR file
at
org.apache.lucene.store.MMapDirectory.lookupProvider(MMapDirectory.java:437)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at
org.apache.lucene.store.MMapDirectory.doPrivileged(MMapDirectory.java:395)
at org.apache.lucene.store.MMapDirectory.<clinit>(MMapDirectory.java:445)
at org.apache.lucene.store.FSDirectory.open(FSDirectory.java:161)
at org.apache.lucene.store.FSDirectory.open(FSDirectory.java:156)
at org.apache.lucene.demo.IndexFiles.main(IndexFiles.java:127)
Caused by: java.lang.ClassNotFoundException:
org.apache.lucene.store.MemorySegmentIndexInputProvider
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at
java.base/java.lang.invoke.MethodHandles$Lookup.findClass(MethodHandles.java:2869)
at
org.apache.lucene.store.MMapDirectory.lookupProvider(MMapDirectory.java:422)
... 6 more

the full classpath is usually very long as it will contain not only lucene
but also all the 3rd party dependencies.

On Mon, Apr 22, 2024 at 8:44?AM Michael Sokolov <msokolov@gmail.com> wrote:

> I also found this helpful documentation by looking in the source code
> of SearchFiles.java: https://lucene.apache.org/core/9_10_0/demo/
>
> On Mon, Apr 22, 2024 at 4:40?AM Stefan Vodita <stefan.vodita@gmail.com>
> wrote:
> >
> > Hi Siddharth,
> >
> > If you happen to be using IntelliJ, you can run a demo class from the
> IDE.
> > It probably works with other IDEs too, though I haven't tried it.
> >
> >
> > Stefan
> >
> > On Sun, 21 Apr 2024 at 23:59, Siddharth Jain <siddhsql@gmail.com> wrote:
> >
> > > Hello,
> > >
> > > I am a new user to Lucene. I checked out the Lucene repo
> > > <https://github.com/apache/lucene/tree/releases/lucene/9.10.0> and
> synced
> > > to releases/lucene/9.10.0 tag. From there I have run following
> commands:
> > >
> > > ./gradlew
> > > ./gradlew assemble
> > >
> > > I would now like to run the demo program. How can I do that? I see some
> > > class files under lucene/demo/build/classes/java/main but how do I
> build
> > > the full classpath with all the dependencies needed to run the demo
> > > program? Can anyone help me? Thanks,
> > >
> > > S.
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Help running the demo program [ In reply to ]
If you download the binary distribution, try this:

Windows:
java --module-path modules;modules-thirdparty --module
org.apache.lucene.demo/org.apache.lucene.demo.IndexFiles

Linux/Unix/Mac:
java --module-path modules:modules-thirdparty --module
org.apache.lucene.demo/org.apache.lucene.demo.IndexFiles

We should make launching those demos easier, sorry about this. Like Mike
said though,
Lucene is a low-level library - the "demos" are mostly meant to be run from
an IDE or as a resource for copy/pasting into
your own sources.

D.

On Mon, Apr 22, 2024 at 12:59?AM Siddharth Jain <siddhsql@gmail.com> wrote:

> Hello,
>
> I am a new user to Lucene. I checked out the Lucene repo
> <https://github.com/apache/lucene/tree/releases/lucene/9.10.0> and synced
> to releases/lucene/9.10.0 tag. From there I have run following commands:
>
> ./gradlew
> ./gradlew assemble
>
> I would now like to run the demo program. How can I do that? I see some
> class files under lucene/demo/build/classes/java/main but how do I build
> the full classpath with all the dependencies needed to run the demo
> program? Can anyone help me? Thanks,
>
> S.
>