3

i have seen other blogs and SO questions relating to this issue but none of them seem to help. I am trying to install sunspot with solr, however i keep getting an error when running the following command:

bundle exec rake sunspot:solr:start

The is the trace from running the command:

** Invoke sunspot:solr:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:solr:run
/home/i7core/.rvm/gems/ruby-1.9.3-p125/bin/rake: No such file or directory - java -version
rake aborted!
You need a Java Runtime Environment to run the Solr server

My gemfile:

gem 'sunspot_rails', '~> 1.3.0'
gem 'sunspot_solr'

Seems like i do not have a java runtime environment, but i have already installed java. Not sure what to do. There have also been a few github issues and everthing seems to work with the latest version, but i still cannot get it to work. Please help.

Hishalv
  • 3,052
  • 3
  • 29
  • 52

2 Answers2

5

One of the fast ways to install JRE on Ubuntu:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Prostakov
  • 910
  • 1
  • 12
  • 22
  • No longer works :( E: Package 'oracle-java7-installer' has no installation candidate – Mark May 06 '18 at 13:13
2

You need the Java JRE installed, eather the Oracle version or OpenJDK one did fine for me. Additionally, make sure, the java executable is in your path that the rake task can see.

moritz
  • 25,477
  • 3
  • 41
  • 36
  • i have reinstalled openjDk and running the rake task still does not work. So i am guessing that it could be java executable is not in the path for the rake task. I am not sure how to do this? Please help – Hishalv Apr 02 '12 at 14:12
  • when you execute `java -version` on the terminal. Does it work? – moritz Apr 02 '12 at 14:45
  • thanks, i got it to work, when i ran the command "java -version" it did not detect java, so i installed the java runtime stuff from software manager, and then i worked correctly, thanks for leading me in the correct direction. Is getting solr and sunspot difficult to get working in a production environment(heroku)? – Hishalv Apr 02 '12 at 17:16