You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by rameshkjes <ra...@gmail.com> on 2018/04/18 14:34:47 UTC

Run solr server using Java program

Hi guys, 

I am able to run the solr instance, add the core and import the data
manually. But I want to do everything with the help of Java program, I
searched a lot but did not find any relevant answer. 

In order to run the solr server, i execute following command inside
directory: D:\software\solr-7.2.0\solr-7.2.0\bin 

    " /solr.cmd -s "C:\Users\lucky\github\myproject\solr-config"/  "  

After that I access to " /http://localhost:8983/solr// "  

and select the name of core which is "demo" 

and then I select/ dataimport/ tab and "/execute/" to import documents. 

First thing what i tried is to run the solr server using Java program, which
I am unable to do. Could anyone please with that? 

I am using Solr 7.2.0

Thanks 



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Run solr server using Java program

Posted by Shawn Heisey <ap...@elyograg.org>.
On 4/20/2018 6:01 AM, rameshkjes wrote:
> Using solrJ, I am able to access the solr core. But still I need to go to
> command prompt to execute command for solr instance. Is there way to do
> that?

I saw that you entered the IRC channel previouslyand asked the same 
question, but I got no response from you when I tried to get more 
information.  And then you left the channel shortly afterwards.

Checking IRC this morning, it looks like you logged into the channel 
again hours before I woke up for the day.  And a little later, I tried 
to speak to you there, but your connection timed out before I was done 
typing my message.  This is what I said:

10:16 <@elyograg> Ramesh_: there is EmbeddedSolrServer.  But this is not
                   recommended for production.  It cannot be made fault
                   tolerant, and it is only accessible from the program that
                   started it.

Solr is best used as a service.  There is a service installer script 
included with Solr that works on typical non-windows operating systems.  
You mentioned solr.cmd on IRC, so I'm guessing it's on Windows.  You're 
on your own for getting a service running there.  I recommend looking at 
NSSM.

EmbeddedSolrServer can work well for tests.

Thanks,
Shawn


Re: Run solr server using Java program

Posted by Alessandro Benedetti <a....@sease.io>.
To do what?
If you mean to start a Solr Server instance, you have the solr.sh ( or the
windows starter).
You can set up your automation stack to be able to startup Solr one click.
SolrJ is a client which means you need Solr up and running.

Cheers

On Fri, 20 Apr 2018, 16:51 rameshkjes, <ra...@gmail.com> wrote:

> Using solrJ, I am able to access the solr core. But still I need to go to
> command prompt to execute command for solr instance. Is there way to do
> that?
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>

Re: Run solr server using Java program

Posted by rameshkjes <ra...@gmail.com>.
Using solrJ, I am able to access the solr core. But still I need to go to
command prompt to execute command for solr instance. Is there way to do
that? 



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Run solr server using Java program

Posted by Alessandro Benedetti <a....@sease.io>.
There are various client API to use Apache Solr[1], in your case what you
need is SolrJ[2] .

Cheers

[1] https://lucene.apache.org/solr/guide/7_3/client-apis.html
[2] https://lucene.apache.org/solr/guide/7_3/using-solrj.html#using-solrj



-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Run solr server using Java program

Posted by TK Solr <tk...@sonic.net>.
The solr.cmd starts Solr by running java -jar start.jar, which has the MANIFEST 
file that tells the java command that it's main class is 
org.eclipse.jetty.start.Main.

So, I would think your Java program should be able to start Solr (jetty, really) 
by calling org.exlipse.jetty.start.Main.main(argv).

But a big question is why you'd like to do that.

TK

On 4/18/18 7:34 AM, rameshkjes wrote:
> Hi guys,
>
> I am able to run the solr instance, add the core and import the data
> manually. But I want to do everything with the help of Java program, I
> searched a lot but did not find any relevant answer.
>
> In order to run the solr server, i execute following command inside
> directory: D:\software\solr-7.2.0\solr-7.2.0\bin
>
>      " /solr.cmd -s "C:\Users\lucky\github\myproject\solr-config"/  "
>
> After that I access to " /http://localhost:8983/solr// "
>
> and select the name of core which is "demo"
>
> and then I select/ dataimport/ tab and "/execute/" to import documents.
>
> First thing what i tried is to run the solr server using Java program, which
> I am unable to do. Could anyone please with that?
>
> I am using Solr 7.2.0
>
> Thanks
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>