I followed these steps on https://github.com/karmi/tire to install elasticsearch for use with ruby on rails
curl -k -L -o elasticsearch-0.17.6.tar.gz http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz
tar -zxvf elasticsearch-0.17.6.tar.gz
./elasticsearch-0.17.6/bin/elasticsearch -f
I am running this on MinGW on windows 7, and most of the process went
smoothly.
However, as I try to start the server with ./elasticsearch-0.17.6/bin/
elasticsearch -f I get a java no class def found error:
$ ./elasticsearch-0.17.6/bin/elasticsearch
Exception in thread "main" java.lang.NoClassDefFoundError: org/
elasticsearch/bootstrap/ElasticSearch
Caused by: java.lang.ClassNotFoundException:
org.elasticsearch.bootstrap.ElasticSearch
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class:
org.elasticsearch.bootstrap.ElasticSearch. Program will exit.
What gives?
Mingw translates paths and environment variables into UNIX equivalents. It’s designed to work with its own tools, and running something foreign to it, like
java.exe, doesn’t always work out as you’d expect. In particular, that script builds a Java classpath in the variableES_CLASSPATHand then passes it to Java using the-cpswitch, and I bet it’s passing Java a path it simply doesn’t understand.What I would do is find the line that executes
java.exein that script, and make a copy of the line prepended with “echo” so that you can see the command line that’s being executed. Then adjust the script to provide a proper Java classpath.