Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC5CB961B for ; Thu, 2 Feb 2012 03:58:46 +0000 (UTC) Received: (qmail 44431 invoked by uid 500); 2 Feb 2012 03:58:41 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 43667 invoked by uid 500); 2 Feb 2012 03:58:15 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 43214 invoked by uid 99); 2 Feb 2012 03:58:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2012 03:58:08 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of nibing_520@hotmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2012 03:58:01 +0000 Received: from ben.nabble.com ([192.168.236.152]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Rsnnn-0005sA-Pz for solr-user@lucene.apache.org; Wed, 01 Feb 2012 19:57:39 -0800 Date: Wed, 1 Feb 2012 19:57:39 -0800 (PST) From: bing To: solr-user@lucene.apache.org Message-ID: <1328155059795-3708902.post@n3.nabble.com> Subject: Fail to compile Java code (trying to use SolrJ with Solr) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, all, I am trying to coding Java so that use SolrJ to access Solr, but failed in the first attempt. I have some experience in Solr, but I am a newbie of SolrJ. The following are the description of what I set, what I did, and what I got. I will be grateful if anyone can bring out some suggestions and point out my mistakes. What I have: Following are the necessary tools installed 1. Java 1.6.0_26 2. apache-tomcat-6.0.32 3. apache-solr-3.5.0 4. apache-solr-3.5.0-src 5. apache-maven-2.2.1 6. apache-ant-1.8.2 What I Set: 1. Classpath c:\apache-solr-3.5.0\apache-solr-3.5.0\dist Following are the jars might be used and also consisted in the directory indicated in the classpath: apache-solr-solrj-3.5.0.jar solrj-lib/commons-httpclient-3.1.jar solrj-lib/commons-codec-1.5.jar 2. Pom.xml in C:\apache-solr-3.5.0-src\apache-solr-3.5.0\ Adding the following dependency: org.apache.solr solr-solrj 3.5.0 What I Did: 1. Try to compile a MySolrJTest.java. Following is the sc, simple enough. import org.apache.solr.client.solrj.SolrServer; class MySolrjTest { public void query(String q) { CommonsHttpSolrServer server = null; try { server = new CommonsHttpSolrServer("http://localhost:8983/solr/"); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) { MySolrjTest solrj = new MySolrjTest(); solrj.query(args[0]); } } What I Get: After I compile the code using the following command, errors arouse: C:\apache-solr-3.5.0-src>javac MySolrjTest.java MySolrjTest.java:1: package org.apache.solr.client.solrj does not exist import org.apache.solr.client.solrj.SolrServer; ^ MySolrjTest.java:7: cannot find symbol symbol : class CommonsHttpSolrServer location: class MySolrjTest CommonsHttpSolrServer server = null; ^ MySolrjTest.java:11: cannot find symbol symbol : class CommonsHttpSolrServer location: class MySolrjTest server = new CommonsHttpSolrServer("http://localhost:8983/solr/"); ^ 3 errors Best Bing -- View this message in context: http://lucene.472066.n3.nabble.com/Fail-to-compile-Java-code-trying-to-use-SolrJ-with-Solr-tp3708902p3708902.html Sent from the Solr - User mailing list archive at Nabble.com.