I'm trying to install Elasticsearch 1.1.0 on OSX Mavericks but i got the following errors when i'm trying to start:
:> ./elasticsearch Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:252) at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:236) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Also when i'm executing the same command with -v arg, i got this error:
:> ./elasticsearch -v Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_36 at org.elasticsearch.Version.<clinit>(Version.java:42)
Here's my environment:
Java version
>: java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Instalation path (downloaded .tar.gz archive from elasticsearch download page and extracted here):
/usr/local/elasticsearch-1.1.0
ENV vars:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home CLASSPATH=/usr/local/elasticsearch-1.1.0/lib/*.jar:/usr/local/elasticsearch-1.1.0/lib/sigar/*.jar
i finally make it working, unfortunally not sure how because i tried a lot of changes :). But here's a list of changes i made that can help:
i removed jdk and jre and reinstalled on a clean env. http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096855
i deleted all the cache dirs.I suppose this can be the 'cause' for that it's working now
~/Library/Caches
/Library/Caches
i removed CLASSPATH env var.
ES_PATH and ES_HOME env vars are not set either, but i think this is not so important.
Note: now it's working also if i'm installing with brew.
Thanks.
Because Elasticsearch uses Java, we need to ensure the Java Development Kit (JDK) is installed.
1 Answer. Show activity on this post. As far as I know, brew installs in separate directory ( /usr/local/Cellar/ ) and if you have installed yor previous version manually (wothout brew) after brew install elasticsearch you will get a new copy of elasticsearch on your MAC.
You should really consider using brew. It's a great tool that will take care of dependencies, version control and much more.
To install Elasticsearch using brew, simply:
brew update brew install elasticsearch
Boom! Done.
After that follow Elasticsearch instructions :
To have launchd start Elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load Elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don't want/need launchctl, you can just run:
elasticsearch
As there are not very good instructions for actually "installing" it onto a Mac:
JAVA_HOME
environment variable.bin/elasticsearch
from the extracted directory.Download Java
Only need the JRE if you will not be writing code on the same machine.
I assume that you are getting the latest JDK, which is currently JDK 8 (as you appear to have, and I have installed working on my machine).
Download and extract Elasticsearch and extract it into some directory.
mkdir -p ~/dev/elasticsearch
Optionally move the downloaded file to there:
mv Downloads/elasticsearch* ~/dev/elasticsearch
Extract the downloaded file:
cd ~/dev/elasticsearch
(if you moved it in step 2)
If it's the zip, then unzip elasticsearch-1.1.0.zip
(or if you don't want to cd
into the directory, then just run unzip elasticsearch-1.1.0.zip -d ~/dev/elasticsearch
)
If it's the tar, then tar -xvf elasticsearch-1.1.0.tar.gz
(or if you don't want to cd
into the directory, then just run tar -xvf elasticsearch-1.1.0.tar.gz -C ~/dev/elasticsearch
)
Cleanup (if you want) by removing the downloaded file:
rm elasticsearch-1.1.0.*
Open your .bash_profile
file for your bash profile settings:
vi ~/.bash_profile
In the file, export your environment variable(s)
export ES_HOME=~/dev/elasticsearch/elasticsearch-1.1.0
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
export PATH=$ES_HOME/bin:$JAVA_HOME/bin:$PATH
Close and re-open your Terminal OR
Run source ~/.bash_profile
to update the environment variables
Run Elasticsearch:
elasticsearch
$ES_HOME/bin
to the PATH
. Then, just go to ES_PATH
(cd $ES_PATH
, then bin/elasticsearch
) or run $ES_PATH/bin/elasticsearch
.Note: Do not setup your CLASSPATH
without a very good reason. The scripts will do that for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With