I tried to download the latest jruby for use on a laptop
running Vista. First I tried the jruby_windows_1_7_2.exe, and that
failed to find the java installation. So I then uninstalled that
and obtained jruby_windowsjre_1_7_2.exe, and that failed in the same
way.
Searching for a solution, the only things I could find on Stack
overflow, I think,
and elsewhere suggested adding a trailing backslash to the JAVA_HOME
environment variable, which I did. I still get the same error
which is this:
C:\Users\hgs>jruby -v
Cannot locate Java installation, specified by JAVA_HOME:
C:\Users\hgs>echo %JAVA_HOME%
c:\jruby-1.7.2\jre\
C:\Users\hgs>
I chose the EXE over the ZIP file on the basis that it would have
better decisions programmed into it than I could make, because I don’t
code in Java. My expectation was that the one with the jre built-in
would be able to point to its own Java Runtime Environment correctly.
Are there any more diagnostics I can supply? This is definitely a 32
bit machine, so my choice of download is not a failure to pick 64bits.
I chose the EXE over the ZIP file on the basis that it would have
better decisions programmed into it than I could make, because I don’t
code in Java. My expectation was that the one with the jre built-in
would be able to point to its own Java Runtime Environment correctly.
Does the more manual install method (extract + set JAVA_HOME env var to
your JDK/JRE) work?
For example, on my Win7 32bit using the Oracle JDK with jruby-bin-1.7.2.tar.gz extracted to C:\jruby I get the following.
I tried the same thing as you on Windows 8 and had the identical result.
It’s odd. The error message it outputs seems to indicate that the
JAVA_HOME is null or empty. That is, the colon implies that it’s going
to output it, but nothing is output.
Here’s something really interesting that convinces me 99% that this is a
bug. When I increased the length of the JAVA_HOME string, I got two
random characters output on the “jruby -v”:
I tried unsetting JAVA_HOME, and tried setting JAVACMD to the java.exe
fully qualified filespec, but neither worked for me. For the latter,
though, my error message changed to:
Failed to create process The parameter is incorrect. (87)
On researching that message it seems that it’s related to a command line
that’s too long (?!).
Interesting to know that the launcher code was C++. The kind of error I
was seeing with the two stray characters was what would happen to me way
back in my C++ days if I output an address value (i.e. pointer),
forgetting to dereference it first. The two characters were a
representation of the numeric value of the address.
environment variable, which I did. I still get the same error
I’m also facing this in win7 enterprise. Possible workaround it to
unset JAVA_HOME like this:
set JAVA_HOME=
In this current shell (cmd), jruby-1.7.2 will then work.
I seem to be able to reproduce this. I’ve not tried deleting it
from the actual environment settings yet, but don’t see why that
should not work either. jgem seems to be working correctly now
as well.
My next two questions would be:
Is this the correct fix?
If so, how do we get this into the installer?
Before we rush into that, though, I’ll reply to the other useful
suggestions.
I tried the same thing as you on Windows 8 and had the identical result.
It’s odd. The error message it outputs seems to indicate that the JAVA_HOME is
null or empty. That is, the colon implies that it’s going to output it, but
nothing is output.
(…)
Bizarre…if this were C or C++ I’d suspect a stray pointer.
The current problem is probably related to the reported bug, but it is
not the same. The bug report says:
“JRuby cannot find Java through JAVA_HOME when option -w is used and
JAVA_HOME points to a JRE. If JAVA_HOME points to a JDK the problems
disappears.”
I tried pointing JAVA_HOME to a JDK and it did not work. I also tried
clearing JAVA_HOME and specifying a fully qualified filespec for
java.exe in JAVACMD, but it did not work.
If I am the only one with this problem, then I suppose we can ignore it.
Am I?
I chose the EXE over the ZIP file on the basis that it would have
For example, on my Win7 32bit using the Oracle JDK with jruby-bin-1.7.2.tar.gz extracted to C:\jruby I get the following.
Well, I don’t have the JDK, and I’m not fluent in Java, so this could
be a useful
step if the steps performed so far are insufficient. At the moment I
think this
is just a question of the installer setting the correct variables to
the correct
values, and that is independent (apart from shared documentation) of
what happens
with the ZIP file. In the interests of dealing with one thing at a
time I will
leave this one for the moment, and maybe come back to it.
The current problem is probably related to the reported bug, but it
is not the same. The bug report says:
“JRuby cannot find Java through JAVA_HOME when option -w is used and
JAVA_HOME points to a JRE. If JAVA_HOME points to a JDK the problems
disappears.”
Well spotted Thank you. They are different.
I tried pointing JAVA_HOME to a JDK and it did not work. I also
tried clearing JAVA_HOME and specifying a fully qualified filespec
for
java.exe in JAVACMD, but it did not work.
If I am the only one with this problem, then I suppose we can ignore
it. Am I?
Maybe the similarity is due to a common root cause?
Keith
Hugh
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.