Windows 7 / Windows 8 - how to compile Solrj

Word Document version of this content: SolrSetup.docx (904.43 kb)

  1. [optional] Development IDE: - Java EE developers

    • Copy eclipse folder to c:\Java
    • Executed Eclipse:
  2. I already had the Java JRE installed (may have impacted steps, i.e., 6c)

  3. Java Development Kit (JDK)

  4. TortoiseSVN -

  5. Linux environment: - setup.exe

    • Root directory c:\Java (root when within Cygwin)
    • Package directory c:\Java\Cygwin (installation files)
    • Add “curl” and click on All icon (see arrow in figure 1), required to import xml data.
  6. Ant -

    • Unzip apache-ant-<ver> to c:\java\Ant

    • Add bin folder to path (fig 3)
    • Note: Ant will not execute at this point! You must copy the tool.jar file from its location in the JDK to the JRE<ver>\Lib folder (fig 4)

    • Test Ant from command prompt – should get “Build.xml does not exist!” message.
  7. Compile application

    • Navigate to c:\Java\LuceneSolr folder

    • Type “ant compile” (fig 5) – there will be a number of warnings (patient may be required the first time)
    • You may need to run “ant ivy-bootstrap”
    • Navigate to the c:\Java\LuceneSolr\Solr folder

    • Type “ant dist” - you must do this from the Solr source code folder. Ant will create a “dist” folder and place the compiled .war and .jar files in it.
    • Navigate to the c:\Java\LuceneSolr\solr\dist folder and copy the apace-solr-<ver>-SNAPSHOT.war file to the c:\Java\LuceneSolr\solr\example\webapps folder (fig 6) – be sure to rename it to solr.war

  8. Start application

    • Navigate to c:\java\LuceneSolr\solr\example

    • Type “java –jar start.jar” (fig 7)
  9. Import Data

    • Launch CygWin application using Icon generated on desktop (fig 8)

    • Type “cd /” to change to root folder – you will find the contents of the Java folder if you followed my folder structure naming conventions. I find this layout makes navigation easier as you pretty much follow the same steps that you would from a command prompt.
    • Type “ls-al” to view contents of folder (optional)
    • Type “cd LuceneSolr/Solr/example/exampledocs”, note - if you do an “ls-al” here you will find all of the sample .xml files.
    • Type “./ *.xml” to import all sample data into the currently running solr core. Note: if you did not install “curl” in step 5c this will not work. The “.” before the command is important, without it the environment will not find the file (unlike MS command prompt the current directory is not considered in the default path).
  10. Launch Solr

Figure 1 - Cygwin package selection - "curl"

Figure 2 - Source code repository

Figure 3 - Add Ant bin to path

Figure 4 - Copy tools.jar to Jre7/Lib

Figure 5 - Compile the application

Figure 6 - Copy compiled war file to webapps folder

Figure 7 - Start Solr using Jetty

Figure 8 - Launching CygWin

Figure 9 - using to import files

HowToCompileSolr (last edited 2014-07-29 15:59:12 by 199)