Production setting for Rake not working in jRuby 1.7.0

On our Windows 2008 server the following command stopped working after
upgrading to jRuby 1.7.0

jruby -S rake RAILS_ENV=production daily_sync
Cannot locate Java installation, specified by JAVA_HOME:

jruby -S rake daily_sync

works OK

So, two problems:

  1. The production setting doesn’t work for Rake

  2. Any error in the command line always results in the same error
    message:

Cannot locate Java installation, specified by JAVA_HOME:

Any thoughts?

On 26.10.2012 20:12, Ken E. wrote:

On our Windows 2008 server the following command stopped working
after
upgrading to jRuby 1.7.0

jruby -S rake RAILS_ENV=production daily_sync

Cannot locate Java installation, specified by JAVA_HOME:

You can get more detailed info from the JRuby launcher with:

jruby -Xtrace log.txt

That may or may not give you more hints.


Patrick M.

In recent Java versions for Windows, it is recommended that

JAVA_HOME should be set in the System Variables box of Environment
Variables instead of the User Variables box.

JAVA_HOME should provide the location of the jdk rather than the jre.
Apparently, there are differences between the jre nested under the jdk
and
the non-nested jre.
For example,
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_09
would be the correct setting for the latest java update.

Patrick M. wrote in post #1081505:

On 26.10.2012 20:12, Ken E. wrote:

On our Windows 2008 server the following command stopped working
after
upgrading to jRuby 1.7.0

jruby -S rake RAILS_ENV=production daily_sync

Cannot locate Java installation, specified by JAVA_HOME:

You can get more detailed info from the JRuby launcher with:

jruby -Xtrace log.txt

That may or may not give you more hints.


Patrick M.

Thanks, I ran the xTrace and the only thing that looked suspicious is
jruby looks for the registry entry for JavaHome which points to the 32
bit client installed in

C:\Program Files (x86) (which is used for FireFox)

I installed the 64 bit version of jRuby with the JRE and the JAVA_HOME
points to:

c:\jruby-1.7.0\jre

This all seems ok except for the JVM stuff at end of the dump:

-Xbootclasspath/a:c:\jruby-1.7.0\lib\jruby.jar
Java DLL path: C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll
PrepareDllPath: C:\Program Files (x86)\Java\jre7\bin
JvmLauncher::Jvm::init()
LoadLibrary(“C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll”)
PrepareDllPath: C:\Program Files (x86)\Java\jre7\bin
JVM options:
-Djdk.home=ss
-Djruby.home=c:\jruby-1.7.0
-Djruby.script=jruby
-Djruby.shell=cmd.exe
-Djffi.boot.library.path=c:\jruby-1.7.0\lib\native\i386-Windows;c:\jruby-1.7.0\lib\native\x86_64-Windows
-Xmx500m
-Xss2048k
-Dsun.java.command=org.jruby.Main
-Djava.class.path=.;C:\IBM\SQLLIB\java\db2java.zip;C:\IBM\SQLLIB\java\db2jcc.jar;C:\IBM\SQLLIB\java\sqlj.zip;C:\IBM\SQLLIB\java\db2jcc_license_cu.jar;C:\IBM\SQLLIB\bin;C:\IBM\SQLLIB\java\common.jar;
-Xbootclasspath/a:c:\jruby-1.7.0\lib\jruby.jar
Creating JVM…

Bottom line is I can run jruby without any command line parameters but
as soon as I add a parameter (e.g., production), the command errors
with:

Cannot locate Java installation, specified by JAVA_HOME:

Just passing this along:

Someone suggested that that checking these things may help:

Cannot locate Java installation, specified by JAVA_HOME:

In recent Java versions for Windows, it is recommended that

JAVA_HOME should be set in the System Variables box of Environment
Variables instead of the User Variables box.

JAVA_HOME should provide the location of the jdk rather than the jre.
Apparently, there are differences between the jre nested under the jdk
and
the non-nested jre.

For example,
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_09
would be the correct setting for the latest java update.


Patrick M.

On Monday, October 29, 2012 5:15:05 PM UTC, Ken E. wrote:

Cannot locate Java installation, specified by JAVA_HOME:

In recent Java versions for Windows, it is recommended that

JAVA_HOME should be set in the System Variables box of Environment
Variables instead of the User Variables box.

JAVA_HOME should provide the location of the jdk rather than the jre.
Apparently, there are differences between the jre nested under the jdk
and
the non-nested jre.

For example,
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_09
would be the correct setting for the latest java update.

Hello Ken E.

Have you resolved your problem?

if need be, please try to set JAVA_HOME=“XXX\java\jdk-1.6.X” as
JDK_HOME.

in really,JRUBY reads your JDK_HOME, I guess that if you installed
several
JDKs.

good luck

Kenny

This issue has been frustrating. I have tried many different
configurations and finally found one that works. What I learned in this
process is using the Oracle Java installer is problematic. One issue is
JAVA_HOME is set as Windows registry setting and I have not figured out
what is really used when running jruby, the Environment variable
JAVA_HOME or the registry setting.

I tried uninstalling the 32bit JRE7 and installing the 64bit JRE7. That
didn’t work.

What worked is I uninstalled Oracle JRE7 completely and used the JRE
that installs with jruby. To do that I set the system environment
variables:

JAVA_HOME = C:\jruby-1.7.0\jre

PATH = %JAVA_HOME%\bin + PATH

Note, our Rails application runs with WebSphere as as such none of this
impacted our application since WAS uses its own JVM.

The problem was with several Rake tasks that are invoked using the
Windows Task Scheduler.