[
https://issues.apache.org/jira/browse/SOLR-6031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Anshum Gupta resolved SOLR-6031.
--------------------------------
Resolution: Invalid
Kindly ask the 'How do I..' questions on the user-list/irc.
> Getting Cannot find symbol while Compiling the java file.
> ---------------------------------------------------------
>
> Key: SOLR-6031
> URL: https://issues.apache.org/jira/browse/SOLR-6031
> Project: Solr
> Issue Type: Task
> Components: clients - java
> Environment: Centos6.5, Solr-4.7.1, java version "1.7.0_51"
> Reporter: Vikash Kumar Singh
> Priority: Minor
> Labels: newbie, test
>
> Here is the code which i am using just for testing purpose first on console
> as
> import org.apache.solr.client.solrj.SolrServerException;
> import org.apache.solr.client.solrj.impl.HttpSolrServer;
> import org.apache.solr.client.solrj.SolrQuery;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.SolrDocumentList;
> import java.net.MalformedURLException;
> public class SolrJSearcher
> {
> public static void main(String[] args) throws
> MalformedURLException,SolrServerException
> {
> HttpSolrServer solr = new
> HttpSolrServer("http://localhost:8983/solr");
> SolrQuery query = new SolrQuery();
> query.setQuery("sony digital camera");
> query.addFilterQuery("cat:electronics","store:amazon.com");
> query.setFields("id","price","merchant","cat","store");
> query.setStart(0);
> query.set("defType", "edismax");
> QueryResponse response = solr.query(query);
> SolrDocumentList results = response.getResults();
> for (int i = 0; i < results.size(); ++i)
> {
> System.out.println(results.get(i));
> }
> }
> }
> Also i hv set the classpath as
> export
> CLASSPATH=/home/vikash/solr-4.7.1/dist/*.jar:/home/vikash/solr-4.7.1/dist/solrj-lib/*.jar
> but still while compiling i get these errors, i don't know what to do now,
> please help
> [root@localhost vikash]# javac SolrJSearcher.java
> SolrJSearcher.java:1: package org.apache.solr.client.solrj does not exist
> import org.apache.solr.client.solrj.SolrServerException;
> ^
> SolrJSearcher.java:2: package org.apache.solr.client.solrj.impl does not exist
> import org.apache.solr.client.solrj.impl.HttpSolrServer;
> ^
> SolrJSearcher.java:3: package org.apache.solr.client.solrj does not exist
> import org.apache.solr.client.solrj.SolrQuery;
> ^
> SolrJSearcher.java:4: package org.apache.solr.client.solrj.response does not
> exist
> import org.apache.solr.client.solrj.response.QueryResponse;
> ^
> SolrJSearcher.java:5: package org.apache.solr.common does not exist
> import org.apache.solr.common.SolrDocumentList;
> ^
> SolrJSearcher.java:10: cannot find symbol
> symbol : class SolrServerException
> location: class SolrJSearcher
> public static void main(String[] args) throws
> MalformedURLException,SolrServerException
> ^
> SolrJSearcher.java:12: cannot find symbol
> symbol : class HttpSolrServer
> location: class SolrJSearcher
> HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr");
> ^
> SolrJSearcher.java:12: cannot find symbol
> symbol : class HttpSolrServer
> location: class SolrJSearcher
> HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr");
> ^
> SolrJSearcher.java:13: cannot find symbol
> symbol : class SolrQuery
> location: class SolrJSearcher
> SolrQuery query = new SolrQuery();
> ^
> SolrJSearcher.java:13: cannot find symbol
> symbol : class SolrQuery
> location: class SolrJSearcher
> SolrQuery query = new SolrQuery();
> ^
> SolrJSearcher.java:19: cannot find symbol
> symbol : class QueryResponse
> location: class SolrJSearcher
> QueryResponse response = solr.query(query);
> ^
> SolrJSearcher.java:20: cannot find symbol
> symbol : class SolrDocumentList
> location: class SolrJSearcher
> SolrDocumentList results = response.getResults();
> ^
> 12 errors
> [root@localhost vikash]#
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]