Windows 7 / Windows 8 - how to compile Solrj
Word Document version of this content: SolrSetup.docx (904.43 kb)
[optional] Development IDE: http://www.eclipse.org/downloads/ - Java EE developers
- Copy eclipse folder to c:\Java
- Executed Eclipse:
Workspace prompt, input => c:\java\EclipseWorkspace
I already had the Java JRE installed (may have impacted steps, i.e., 6c)
Java Development Kit (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.html
TortoiseSVN - http://tortoisesvn.net/downloads.html
- Executed TortoiseSVN installation msi
- Selected “command line client tools”
Created c:\java\LuceneSolr folder
Right click c:\java\LuceneSolr – selected “SVN Checkout”
Solr website for source code: http://lucene.apache.org/solr/versioncontrol.html
Input (fig 2): http://svn.apache.org/repos/asf/lucene/dev/ Click Button
- Select /branches/lucene3661
- Clicked “Head” button (then clicked OK to accept default)
- Clicked OK (exited Head wizard)
- Clicked OK (exited Checkout window) download starts
- Executed TortoiseSVN installation msi
Linux environment: http://cygwin.com/ - 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.
Ant - http://ant.apache.org/bindownload.cgi
Unzip apache-ant-<ver>-bin.zip 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.
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
Start application
Navigate to c:\java\LuceneSolr\solr\example
- Type “java –jar start.jar” (fig 7)
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 “./post.sh *.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 post.sh 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).
- Launch Solr
http://localhost.:8983/solr/admin - likewise you can now execute the links on the Tutorials page at this link => http://lucene.apache.org/solr/tutorial.html
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 post.sh to import files