Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Edward

Yii Elasticsearch

Recommended Posts

I installed Java version 8 it shows the java icon in System Preferences on my iMac.

 

When i try to run ElasticSearch from terminal i get this message coming up:

Edwards-iMac:~ EDWARD$ /Users/EDWARD/Desktop/Elastic\ Search/elasticsearch-1.4.0/bin/elasticsearch ; exit;
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/elasticsearch/bootstrap/Elasticsearch : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
logout

[Process completed]

I have looked at some of the threads on GitHub but i don't actually understand what they saying? Does anyone have any idea where and what i should edit into files?

 

https://github.com/Homebrew/homebrew/issues/29610#issuecomment-47778002

Share this post


Link to post
Share on other sites

When i run

 

java -version from terminal, it comes with:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Java 1.6 is unsupported by ElasticSearch, i have installed Java platform 1.8, product 1.8.0_25 with path

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

 

I am not sure what i have to do to change the Java being used. I don't know anything much about terminal. I have found this other thread that can help but when i tried this elastic search still gives the same error.

 

https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Share this post


Link to post
Share on other sites

On my computer (not yet running Yosemite), /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java is version 1.7.0_71, whereas the default Java is 1.6.0_65. The steps on that GitHub page basically tell the computer to use the library plugin version of Java for Java.

 

So first you need to open your .bash_profile file, which is a hidden file in your home directory. You can do this in the command line or in your text editor (if it supports an open hidden option).

 

Then you add this line to that file:

 

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

 

This says that directory should be your JAVA_HOME value. ElasticSearch uses that JAVA_HOME value. 

 

Then close all Terminal windows and reopen a new one to make sure the change takes effect (after saving your .bash_profile). You should now be able to start ElasticSearch.

  • Upvote 1

Share this post


Link to post
Share on other sites

That's why i love you Larry, i just created the a .bash_profile file in my home directory added the line you suggested

 

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

 

and then everything works. Amazing.

 

Thanks for your help, christmas is coming soon. :)

Share this post


Link to post
Share on other sites

I got the search up and running now. It took me a while to get it integrated into my website. But it was worth it this search engine is much better than the original search. Lucene worked out really good it has some advanced search features rather than the basic Myisam databases. So after a bit of extra work I got it figured out.

Share this post


Link to post
Share on other sites

Yeah, everything good in terms of search seems to be based on Lucene. Often not easy to get going with (in part, because it's Java), but normally worth the effort.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...