Forum: JRuby Vista jruby fails to locate java installation.

Posted by H. Sasse (Guest)
on 2013-01-08 23:35
(Received via mailing list)
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.

Thank you
Hugh
Posted by Jon Forums (jonm)
on 2013-01-08 23:56
(Received via mailing list)
>
> 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.

C:\Users\Jon\Documents>which jruby
C:\jruby\bin\jruby

C:\Users\Jon\Documents>set JA
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_10

C:\Users\Jon\Documents>jruby --version
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 
1.7.0_10-b18 +indy [Windows 7-x86]

C:\Users\Jon\Documents>set JAVA_HOME=C:\Program Files\Java\jre7

C:\Users\Jon\Documents>set JA
JAVA_HOME=C:\Program Files\Java\jre7

C:\Users\Jon\Documents>jruby --version
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 
1.7.0_10-b18 +indy [Windows 7-x86]


Jon

---
Fail fast. Fail often. Fail publicly. Learn. Adapt. Repeat.
http://thecodeshop.github.com | http://jonforums.github.com/
twitter: @jonforums
Posted by Keith B. (keith_b)
on 2013-01-09 00:12
(Received via mailing list)
Hugh -

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":

C:\Program Files (x86)\Java>set JAVA_HOME="C:/Program Files 
(x86)/Java/jdk1.7.0_
10"

C:\Program Files (x86)\Java>jruby -v
Cannot locate Java installation, specified by JAVA_HOME:
LS

C:\Program Files (x86)\Java>jruby -v
Cannot locate Java installation, specified by JAVA_HOME:
P▼

C:\Program Files (x86)\Java>set JAVA_HOME="C:/Program Files 
(x86)/Java/jre333333
3333"

C:\Program Files (x86)\Java>jruby -v
Cannot locate Java installation, specified by JAVA_HOME:
≡±

Bizarre…if this were C or C++ I'd suspect a stray pointer.

- Keith
Posted by Claus Folke Brobak (cfbrobak)
on 2013-01-09 09:06
H. Sasse wrote in post #1091512:
>
> C:\Users\hgs>jruby -v
> Cannot locate Java installation, specified by JAVA_HOME:
>

I believe it is the same problem I have reported here:

http://jira.codehaus.org/browse/JRUBY-6988

/Claus
Posted by Christian MICHON (Guest)
on 2013-01-09 09:49
(Received via mailing list)
On Tue, Jan 8, 2013 at 11:34 PM, H. Sasse <hgs@vermilion.plus.com> 
wrote:
>
> 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\
>

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.

--
Christian
Posted by "Sébastien LE CALLONNEC" <slc_ie@yahoo.ie> (Guest)
on 2013-01-09 10:28
(Received via mailing list)
Hi,

On Tue, Jan 8, 2013 at 11:11 PM, Keith Bennett <keithrbennett@gmail.com> 
wrote:
>Hugh -
>
>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.

FWIW, it *is* C++: jruby-launcher 
(https://github.com/jruby/jruby-launcher) is used to get the Java 
command and build the classpath when running jruby.


Does setting the `JAVACMD` env variable work?  It does the trick for me.


C:\Users\lecallonnecs>set JAVACMD=blah

C:\Users\lecallonnecs>jruby -v
Failed to create process The system cannot find the file specified. (2)

C:\Users\lecallonnecs>set JAVACMD=C:\Program 
Files\Java\jdk1.7.0_07\bin\java.exe

C:\Users\lecallonnecs>jruby -v
jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit 
Server VM
1.7.0_07-b11 [Windows 7-amd64]



Regards,
Sébastien.
Posted by Keith B. (keith_b)
on 2013-01-09 17:04
(Received via mailing list)
All -

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.

- Keith

---
Keith R. Bennett
http://about.me/keithrbennett
Posted by H. Sasse (Guest)
on 2013-01-09 21:41
(Received via mailing list)
On 09.01.2013 08:47, Christian MICHON wrote:
>> 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.

Thank you
Hugh
Posted by H. Sasse (Guest)
on 2013-01-09 21:58
(Received via mailing list)
On 09.01.2013 09:27, Sébastien LE CALLONNEC wrote:
>> JAVA_HOME is null or empty.  That is, the colon implies that it's
> (https://github.com/jruby/jruby-launcher) is used to get the Java
> Failed to create process The system cannot find the file specified.
> (2)
>
> C:\Users\lecallonnecs>set JAVACMD=C:\Program
> Files\Java\jdk1.7.0_07\bin\java.exe

I don't have a jdk* folder in there only a jre folder.  Maybe this will
work:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\hgs>echo %JAVA_HOME%
c:\jruby-1.7.2\jre\

C:\Users\hgs>set  JAVACMD=%JAVA_HOME%bin\java.exe

C:\Users\hgs>echo %JAVACMD%
c:\jruby-1.7.2\jre\bin\java.exe

C:\Users\hgs>jruby -v
Cannot locate Java installation, specified by JAVA_HOME:


C:\Users\hgs>dir %JAVACMD%
  Volume in drive C has no label.
  Volume Serial Number is 6244-D698

  Directory of c:\jruby-1.7.2\jre\bin

05/01/2013  11:10           174,056 java.exe
                1 File(s)        174,056 bytes
                0 Dir(s)  78,410,694,656 bytes free

C:\Users\hgs>

Apparently that does not fix things without clearing JAVA_HOME, which
we already know
fixes things.

>
Thank you,
Hugh
Posted by H. Sasse (Guest)
on 2013-01-09 22:02
(Received via mailing list)
On 09.01.2013 08:06, Claus Folke Brobak wrote:
> /Claus
Yes, I think that is correct.  I think I found that in my searches.
Thank you
Hugh
Posted by Keith B. (keith_b)
on 2013-01-09 22:11
(Received via mailing list)
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?

- Keith

---
Keith R. Bennett
http://about.me/keithrbennett
Posted by H. Sasse (Guest)
on 2013-01-09 22:22
(Received via mailing list)
On 08.01.2013 22:54, Jon wrote:
>>
>> 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.

    [example trimmed]
>
> Jon
>
Thank you,
Hugh
Posted by H. Sasse (Guest)
on 2013-01-09 22:28
(Received via mailing list)
On 09.01.2013 21:09, Keith Bennett wrote:
> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.