4

I am deploying with Capistrano and everything looked good until I got to Rjb part..

I can do

$ echo $JAVA_HOME
 /usr/lib/jvm/java-1.6.0-openjdk-amd64

More than that, I can do gem install rjb on server and it is getting installed...

However when I try:

$ cap bundle:install 

I get

** [out :: ec-...compute-1.amazonaws.com] extconf.rb:53:in `<main>': JAVA_HOME is not set. (RuntimeError)
Edward Anderson
  • 13,591
  • 4
  • 52
  • 48
Stpn
  • 6,202
  • 7
  • 47
  • 94

1 Answers1

0

Capistrano doesn't load the environment variables from the deployer machine or the deploy target; you'll have to specify them in your deploy.rb:

set :default_environment, 'JAVA_HOME' => "/usr/lib/jvm/java-6-openjdk-amd64"
Edward Anderson
  • 13,591
  • 4
  • 52
  • 48
  • Credit goes to Stpn for answering his own question - I'm just placing this in the Answers section. – Edward Anderson Nov 22 '12 at 03:02
  • 1
    I've been trying to use this with capistrano 3 and I keep getting the same error. Have you tried this on Capistrano 3? I've set the env by the new way they specify. `set :default_env, { 'JAVA_HOME' => "/usr/lib/jvm/java-7-openjdk-amd64" }` I'm not sure what I'm doing wrong. I can install the gem manually on the machine and it works but it doesn't work when running `cap deploy` – meatherly Jul 22 '14 at 20:14
  • Please post a new question, as this question was for capistrano 2. – Edward Anderson Jul 23 '14 at 01:38