Discussion:
[jruby-user] [setup issue] Cannot load java, Jruby-1.7.13, window 7
KennyHuang
2014-06-26 02:46:14 UTC
Permalink
Hello, I'm a student fairly new at ruby programming, and I'm having a huge
deal of trouble just to get Jruby running. I was wondering could you gusy
help me figure out how to setup Jruby on window 7?

Here is the supporting information and What I have tried so far:

I followed the instruction at github for Jruby installation, install
Jruby-1.7.13, JDK1.70,
and set the environmental variable to the following:

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_60\bin
JRUBY_HOME = C:\Jruby\jruby-1.7.13\bin
PATH =
C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Jruby\jruby-1.7.13\bin
pik 0.2.8

When I tried to test some import java function using SubLime text editor:

To start off small, the test program consist of only a single line of

require 'java'

I get the following error:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- java (LoadError)
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from C:/RailsInstaller/Ruby Projects/practice notes.rb:257:in `<main>'

Okay, I figure I just need to switch from ruby to Jruby via pik (since
window doesn't have RVM equivalent)

When I try to add the path of Jruby via Pik using the following commands:

c:\bin>pik add C:\Jruby\jruby-1.7.13\bin

There was an error.
Error: private method `gsub' called for nil:NilClass

in: pik/commands/command.rb:124:in `get_version'
in: pik/commands/add_command.rb:23:in `add'
in: pik/commands/add_command.rb:13:in `execute'
in: pik_runner:33

I get the above error, the googled solution recommend I try to set the
environmental variable JAVA_HOME and JRUBY_HOME to their corresponding
paths. Which I already did before hand and that doesn't see to help.

I tried uninstall and reinstall Jruby and Jdk several times, it did not help
at all.

Is there a way a way to manually change the Jruby's load path?

Please bear in mind, I'm a total noob at programming, so I'm not too
familiar with many technical terms. So If it's possible, please simplify and
be as specific as possible in your instruction. Such as specify where to
type what command, or at specify enough terms so I can google them on my
own.

Thank you for your time

On the side notes, does Jruby share all the gems that were donwload by other
ruby version? or do I need to duplicate all the gems file in Jruby's
equivalent library?



--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589.html
Sent from the JRuby - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Keith Bennett
2014-06-26 03:11:33 UTC
Permalink
Kenny -

It looks like the Ruby 1.9.3 path precedes the JRuby path in your PATH.
As a kludge and a possible way to avoid needing pik, try putting JRuby's
path first.

Also, I believe you can precede the utility names with 'j' for JRuby, so
you can execute 'jruby' instead of 'ruby', 'jgem' instead of 'gem',
'jirb' instead of 'irb'.

Another way to execute JRuby code is to use the jruby jar file in a Java
command, something like this:

java -jar jruby.jar my_script.rb

(where jruby.jar will contain the fully qualified filespec of your
installed JRuby jar file, and my_script.rb is the Ruby script you want
to run).

And yes, you will need to gem install any gems you need separately for
JRuby.

Cheers,
Keith

Keith R. Bennett
http://about.me/keithrbennett
Post by KennyHuang
Hello, I'm a student fairly new at ruby programming, and I'm having a huge
deal of trouble just to get Jruby running. I was wondering could you gusy
help me figure out how to setup Jruby on window 7?
I followed the instruction at github for Jruby installation, install
Jruby-1.7.13, JDK1.70,
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_60\bin
JRUBY_HOME = C:\Jruby\jruby-1.7.13\bin
PATH =
C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Jruby\jruby-1.7.13\bin
pik 0.2.8
To start off small, the test program consist of only a single line of
require 'java'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- java (LoadError)
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from C:/RailsInstaller/Ruby Projects/practice notes.rb:257:in `<main>'
Okay, I figure I just need to switch from ruby to Jruby via pik (since
window doesn't have RVM equivalent)
c:\bin>pik add C:\Jruby\jruby-1.7.13\bin
There was an error.
Error: private method `gsub' called for nil:NilClass
in: pik/commands/command.rb:124:in `get_version'
in: pik/commands/add_command.rb:23:in `add'
in: pik/commands/add_command.rb:13:in `execute'
in: pik_runner:33
I get the above error, the googled solution recommend I try to set the
environmental variable JAVA_HOME and JRUBY_HOME to their corresponding
paths. Which I already did before hand and that doesn't see to help.
I tried uninstall and reinstall Jruby and Jdk several times, it did not help
at all.
Is there a way a way to manually change the Jruby's load path?
Please bear in mind, I'm a total noob at programming, so I'm not too
familiar with many technical terms. So If it's possible, please simplify and
be as specific as possible in your instruction. Such as specify where to
type what command, or at specify enough terms so I can google them on my
own.
Thank you for your time
On the side notes, does Jruby share all the gems that were donwload by other
ruby version? or do I need to duplicate all the gems file in Jruby's
equivalent library?
--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589.html
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
The mosny
2014-06-26 03:19:52 UTC
Permalink
Hello,

It seems to me that your PATH variable has the wring order.

When you call 'ruby' it looks in the folders, specified in this variable. If it finds a match in a folder before your jruby directory it just executes this 'ruby'.

Here it finds MRI(ruby) under the directory C:\RailsInstaller\Ruby\1.9.3\bin before even reaching the directory C:\Jruby\jruby-1.7.13\bin

Try to reorder your PATH variable like so:

PATH=C:\RailsInstaller\Git\cmd;C:\Jruby\jruby-1.7.13\bin;C:\RailsInstaller\Ruby1.9.3\bin

After setting it you should make a reboot, to apply those changes.
Post by KennyHuang
pik 0.2.8
Hello, I'm a student fairly new at ruby programming, and I'm having a huge
deal of trouble just to get Jruby running. I was wondering could you gusy
help me figure out how to setup Jruby on window 7?
I followed the instruction at github for Jruby installation, install
Jruby-1.7.13, JDK1.70,
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_60\bin
JRUBY_HOME = C:\Jruby\jruby-1.7.13\bin
PATH =
C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Jruby\jruby-1.7.13\bin
pik 0.2.8
To start off small, the test program consist of only a single line of
require 'java'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- java (LoadError)
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from C:/RailsInstaller/Ruby Projects/practice notes.rb:257:in `<main>'
Okay, I figure I just need to switch from ruby to Jruby via pik (since
window doesn't have RVM equivalent)
c:\bin>pik add C:\Jruby\jruby-1.7.13\bin
There was an error.
Error: private method `gsub' called for nil:NilClass
in: pik/commands/command.rb:124:in `get_version'
in: pik/commands/add_command.rb:23:in `add'
in: pik/commands/add_command.rb:13:in `execute'
in: pik_runner:33
I get the above error, the googled solution recommend I try to set the
environmental variable JAVA_HOME and JRUBY_HOME to their corresponding
paths. Which I already did before hand and that doesn't see to help.
I tried uninstall and reinstall Jruby and Jdk several times, it did not help
at all.
Is there a way a way to manually change the Jruby's load path?
Please bear in mind, I'm a total noob at programming, so I'm not too
familiar with many technical terms. So If it's possible, please simplify and
be as specific as possible in your instruction. Such as specify where to
type what command, or at specify enough terms so I can google them on my
own.
Thank you for your time
On the side notes, does Jruby share all the gems that were donwload by other
ruby version? or do I need to duplicate all the gems file in Jruby's
equivalent library?
--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589.html
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Eric West
2014-06-26 03:44:02 UTC
Permalink
Also, I believe you can precede the utility names with ‘j’ for JRuby, so
you can execute ‘jruby’ instead of ‘ruby’, ‘jgem’ instead of >’gem’, ‘jirb’
instead of ‘irb’.

Keith’s suggestion is probably the quickest way to get this running. Just
try running jruby instead of ruby. You can do jruby -S gem, jruby -S pry,
etc to run any commands that do not have a specific “J” version.
​
Post by KennyHuang
Hello,
It seems to me that your PATH variable has the wring order.
When you call 'ruby' it looks in the folders, specified in this variable.
If it finds a match in a folder before your jruby directory it just
executes this 'ruby'.
Here it finds MRI(ruby) under the directory
C:\RailsInstaller\Ruby\1.9.3\bin before even reaching the directory
C:\Jruby\jruby-1.7.13\bin
PATH=C:\RailsInstaller\Git\cmd;C:\Jruby\jruby-1.7.13\bin;C:\RailsInstaller\Ruby1.9.3\bin
After setting it you should make a reboot, to apply those changes.
Post by KennyHuang
pik 0.2.8
Hello, I'm a student fairly new at ruby programming, and I'm having a
huge
Post by KennyHuang
deal of trouble just to get Jruby running. I was wondering could you gusy
help me figure out how to setup Jruby on window 7?
I followed the instruction at github for Jruby installation, install
Jruby-1.7.13, JDK1.70,
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_60\bin
JRUBY_HOME = C:\Jruby\jruby-1.7.13\bin
PATH =
C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Jruby\jruby-1.7.13\bin
Post by KennyHuang
pik 0.2.8
To start off small, the test program consist of only a single line of
require 'java'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
Post by KennyHuang
`require': cannot load such file -- java (LoadError)
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
Post by KennyHuang
`require'
from C:/RailsInstaller/Ruby Projects/practice notes.rb:257:in `<main>'
Okay, I figure I just need to switch from ruby to Jruby via pik (since
window doesn't have RVM equivalent)
c:\bin>pik add C:\Jruby\jruby-1.7.13\bin
There was an error.
Error: private method `gsub' called for nil:NilClass
in: pik/commands/command.rb:124:in `get_version'
in: pik/commands/add_command.rb:23:in `add'
in: pik/commands/add_command.rb:13:in `execute'
in: pik_runner:33
I get the above error, the googled solution recommend I try to set the
environmental variable JAVA_HOME and JRUBY_HOME to their corresponding
paths. Which I already did before hand and that doesn't see to help.
I tried uninstall and reinstall Jruby and Jdk several times, it did not
help
Post by KennyHuang
at all.
Is there a way a way to manually change the Jruby's load path?
Please bear in mind, I'm a total noob at programming, so I'm not too
familiar with many technical terms. So If it's possible, please simplify
and
Post by KennyHuang
be as specific as possible in your instruction. Such as specify where to
type what command, or at specify enough terms so I can google them on my
own.
Thank you for your time
On the side notes, does Jruby share all the gems that were donwload by
other
Post by KennyHuang
ruby version? or do I need to duplicate all the gems file in Jruby's
equivalent library?
--
http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589.html
Post by KennyHuang
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
KennyHuang
2014-06-27 11:19:31 UTC
Permalink
Thanks for the quick responses, as per you guys' instruction. I did the
following:

Change the order of %PATH% =
C:\RailsInstaller\Git\cmd;C:\Jruby\jruby-1.7.13\bin;C:\RailsInstaller\Ruby1.9.3\bin

run the test program, still cannot load the file path.

Next I did the following and got these responses:

C:\> jruby -pry
Error: Could not find or load main class org.jruby.Main

C:\> java -jar jruby.jar test.jrb
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\> java --version
'java' is not recognized as an internal or external command,
operable program or batch file.

That's weird, even though I install Jdk in C:\Program Files\Java\jdk1.7.0_60
some how the program is not picking it up



--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589p5000616.html
Sent from the JRuby - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Keith Bennett
2014-06-27 13:05:20 UTC
Permalink
Kenny -

I don't know how the installation stuff works in JRuby on Windows, but
it looks like:

1) for the first error, the jruby executable is found, but the jruby.jar
file is not, and
2) for the last two errors, the java executable's directory is not in
your path.

Have you moved anything around since doing your installations?

I don't know if the JRuby installation installs its own Java runtime,
but I'd recommend reinstalling Java, reinstalling JRuby, and then rebooting.

- Keith


Keith R. Bennett
http://about.me/keithrbennett
Post by KennyHuang
Thanks for the quick responses, as per you guys' instruction. I did the
Change the order of %PATH% =
C:\RailsInstaller\Git\cmd;C:\Jruby\jruby-1.7.13\bin;C:\RailsInstaller\Ruby1.9.3\bin
run the test program, still cannot load the file path.
C:\> jruby -pry
Error: Could not find or load main class org.jruby.Main
C:\> java -jar jruby.jar test.jrb
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\> java --version
'java' is not recognized as an internal or external command,
operable program or batch file.
That's weird, even though I install Jdk in C:\Program Files\Java\jdk1.7.0_60
some how the program is not picking it up
--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589p5000616.html
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
The mosny
2014-06-27 13:16:22 UTC
Permalink
Java still bin directory also needs to be included in your PATH.
Post by Keith Bennett
Kenny -
1) for the first error, the jruby executable is found, but the jruby.jar file is not, and
2) for the last two errors, the java executable's directory is not in your path.
Have you moved anything around since doing your installations?
I don't know if the JRuby installation installs its own Java runtime, but I'd recommend reinstalling Java, reinstalling JRuby, and then rebooting.
- Keith
Keith R. Bennett
http://about.me/keithrbennett
Post by KennyHuang
Thanks for the quick responses, as per you guys' instruction. I did the
Change the order of %PATH% =
C:\RailsInstaller\Git\cmd;C:\Jruby\jruby-1.7.13\bin;C:\RailsInstaller\Ruby1.9.3\bin
run the test program, still cannot load the file path.
C:\> jruby -pry
Error: Could not find or load main class org.jruby.Main
C:\> java -jar jruby.jar test.jrb
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\> java --version
'java' is not recognized as an internal or external command,
operable program or batch file.
That's weird, even though I install Jdk in C:\Program Files\Java\jdk1.7.0_60
some how the program is not picking it up
--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589p5000616.html
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Peter Jahn
2014-06-30 06:34:11 UTC
Permalink
Assuming you quoted your actual configuration, shouldn't the JAVA_HOME
and JRUBY_HOME variables point to the respective installation root
folder (the
folder above bin, like C:\Program Files\Java\jdk1.7.0_60)?

- Peter
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
KennyHuang
2014-07-01 18:34:22 UTC
Permalink
I tried both the version with bin and without bin. Both fail to run,
re-install several time, still not up and running yet.

The issue might be because I download the JRuby 1.7.13 Windows
Executable+JRE (x64) instead of the version without JRE. Could that be the
issue?

The weird thing is that even though I have JDK installed, i still couldn't
access java



--
View this message in context: http://ruby.11.x6.nabble.com/setup-issue-Cannot-load-java-Jruby-1-7-13-window-7-tp5000589p5000712.html
Sent from the JRuby - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Continue reading on narkive:
Search results for '[jruby-user] [setup issue] Cannot load java, Jruby-1.7.13, window 7' (Questions and Answers)
12
replies
What is a java applet?
started 2015-09-22 09:22:11 UTC
programming & design
3
replies
JDK and SDK?
started 2007-09-23 00:16:05 UTC
programming & design
Loading...