JRuby EventMachine no such file to load - jruby

I have intalled EventMachine in JRuby (I am using Win32). When I try the server example, I get an error when
require 'eventmachine'
The error is:
C:\dev\em>jruby server.rb
server.rb:1:in `require': no such file to load -- eventmachine (LoadError)
from server.rb:1
But the gem is installed!
C:\dev\myapp>jruby -S gem install eventmachine
Successfully installed eventmachine-0.12.8-java
1 gem installed
Installing ri documentation for eventmachine-0.12.8-java...
Installing RDoc documentation for eventmachine-0.12.8-java...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README

You need to first load RubyGems,
require 'rubygems'

The gem may not be installed for jruby. Try jgem install eventmachine

Related

jekyll error building page related to kramdown parser

Whenever I run the bundle exec jekyll serve it returns the error
Dependency Error: Yikes! It looks like you don't have kramdown-parser-gfm or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- kramdown-parser-gfm' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
Liquid Exception: kramdown-parser-gfm in /_layouts/default.html
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
kramdown-parser-gfm
so, I tried gem install kramdown-parser-gfm, but it returns the same error after that.
I also tried to remove and reinstall the jekyll and bundle, but didn't work either.
jekyll version 3.9.0 Bundler version 2.1.4
I added gem "kramdown-parser-gfm" to the Gemfile and then ran bundle install.
Now the serve command completes successfully.
delete the Gemfile.lock file
go to gem file add gem "kramdown-parser-gfm"
open terminal and give command bundler
after install all packages, in terminal give command bundle exec jekyll serve
I hope application will run properly now.
On Windows
If you open your gemfile, you will notice the following.
gem "jekyll", "~> 3.2.1"
If you have the specific jekyll version and after running "bundler", you will receive the following errors.
Bundler could not find compatible versions for gem "kramdown":
In Gemfile:
jekyll (~> 3.2.1) was resolved to 3.2.1, which depends on
kramdown (~> 1.3)
kramdown-parser-gfm was resolved to 1.1.0, which depends on
kramdown (~> 2.0)
Remove the specific version of jekyll, like so:
gem "jekyll"
Do not forget to add webrick gem to gemfile
gem "webrick"
Run bundler again.
bundler
Finally, serve
bundle exec jekyll serve --livereload
What worked for me was to add:
gem "rexml"
to the Gemfile.

libv8 fails on installation using jruby

I am trying to bundle install a sample rails 4 app and I am running into the following problem. libv8 fails on installation using jruby 1.7.18.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/kingslee/.rvm/rubies/jruby-1.7.18/bin/jruby extconf.rb
/home/kingslee/.rvm/rubies/jruby-1.7.18/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /home/kingslee/.rvm/rubies/jruby-1.7.18/lib/native/include/ruby/ruby.h
Gem files will remain installed in /home/kingslee/.rvm/gems/jruby-1.7.18#app/gems/libv8-3.16.14.7 for inspection.
Results logged to /home/kingslee/.rvm/gems/jruby-1.7.18#app/gems/libv8-3.16.14.7/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot
continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
I guess rubyrhino should solve the problem - https://github.com/cowboyd/libv8/issues/131

Installing ruby-oci8 with jruby

Trying to install ruby-oci8 with jruby gemset. It's giving me below error
I've tried to use export JRUBY_OPTS="--1.9 -Xcext.enabled=true" as suggested in other similar questions with no luck.
$ jruby -S gem install ruby-oci8
Fetching: ruby-oci8-2.1.7.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/jruby-1.7.5/bin/jruby extconf.rb
/home/user/.rvm/rubies/jruby-1.7.5/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /home/user/.rvm/rubies/jruby-1.7.5/lib/native/include/ruby/ruby.h
Gem files will remain installed in /home/oracle/.rvm/gems/jruby-1.7.5/gems/ruby-oci8-2.1.7 for inspection.
Results logged to /home/oracle/.rvm/gems/jruby-1.7.5/gems/ruby-oci8-2.1.7/ext/oci8/gem_make.out
We can use JDBC, instead of oci8. oci8 needs c extenssions which has been deprecated in jruby.
See this for a working example :: https://gist.github.com/rogerleite/217543

iron_worker zip/zip (LoadError) error using iron_worker_ng gem

I am receiving this error when I'm using ironworker's iron_worker gem to upload and build my worker.
iron_worker upload results in
error:/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- zip/zip (LoadError)
There was a recent change to the rubyzip gem that required a dependency lock on the iron_worker_ng gem.
to fix this update to the latest version by running the command.
gem update iron_worker_ng
Your gem version should be
iron_worker_ng (1.0.2)
You can test this by running
iron_worker -v
It should look like iron_worker_ruby_ng-1.0.2 (iron_core_ruby-1.0.1)
as of 09/12/13.

jruby-lint gem installed but no jrlint available?

I've recently started exploring JRuby using Joe Kutner's book "Deploying with JRuby", but I've hit an issue when trying to install the jruby-lint gem. Below is the output from my attempts, including the version numbers of Java, JRuby, and my OS.
I don't understand the output, especially why nokogiri wouldn't install as a jruby-lint dependency, but would install ok on its own. While the jruby-lint gem is now reported as having installed correctly, it has not delivered a jrlint executable/script to use, and I don't know where to go from here. Any ideas?
C:\Dev\repos\twitalytics>jruby --version
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_21-b11 [Windows 7-amd64]
C:\Dev\repos\twitalytics>jruby -S gem install jruby-lint
Building native extensions. This could take a while...
ERROR: Error installing jruby-lint:
ERROR: Failed to build gem native extension.
C:/Dev/jruby-1.7.3/bin/jruby.exe extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.
(root) at C:/Dev/jruby-1.7.3/lib/ruby/shared/mkmf.rb:8
require at org/jruby/RubyKernel.java:1027
(root) at C:/Dev/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:1
(root) at extconf.rb:5
Gem files will remain installed in C:/Users/Owen/.gem/jruby/1.8/gems/nokogiri-1.6.0.rc1 for inspection.
Results logged to C:/Users/Owen/.gem/jruby/1.8/gems/nokogiri-1.6.0.rc1/ext/nokogiri/gem_make.out
C:\Dev\repos\twitalytics>set JRUBY_OPTS=--1.8
C:\Dev\jruby-1.7.3>jruby --version
jruby 1.7.3 (ruby-1.8.7p370) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_21-b11 [Windows 7-amd64]
C:\Dev\repos\twitalytics>jruby -S gem install jruby-lint
ERROR: Error installing jruby-lint:
nokogiri requires Ruby version >= 1.9.2.
C:\Dev\repos\twitalytics>jruby -S gem install nokogiri
Fetching: nokogiri-1.5.9-java.gem (100%)
Successfully installed nokogiri-1.5.9-java
1 gem installed
C:\Dev\repos\twitalytics>jruby -S gem install jruby-lint
Fetching: jruby-lint-0.4.1.gem (100%)
Successfully installed jruby-lint-0.4.1
1 gem installed
C:\Dev\repos\twitalytics>jrlint
'jrlint' is not recognized as an internal or external command,
operable program or batch file.
I ran into a very similar issue, also while working through this book. Updating Rubygems solved it for me. Perhaps try:
jruby -S gem update --system
It's interesting that it tries to install the Ruby(not JRuby) version of Nokogiri cause it tries to install C extensions.
I think if you install the same version required by jruby-lint which is nokogiri-1.6.0.rc1, problem will be solved.
Neither solution here works for me on Windows. jruby -S gem install nokogiri
installs nokogiri-1.6.0-java
If I download the gem from https://github.com/jruby/jruby-lint and build it myself it leaves the gem folder empty at jruby\lib\ruby\gems\shared\gems\jruby-lint-0.4.1
And it won't make a bat file for running it in the /bin dir. I don't think this gem is ready for windows. Could it be that I'm trying to install it on BitNami stack? I haven't tried it with a regular install of JRuby.
In case updating Rubygems doesn't work, try:
gem install nokogiri
This will install nokogiri-1.6.0-java
then again:
gem install jruby-lint
and you're good to go.