04 Jan 2012, 23:32
Generic-user-small

Charles A. Monteiro (7 posts)

I have worked this example verbatim, here’s the stack when I try to do the rake on big_jar. This is out of the chapter on deployment. I’m running this out of my Windows 7 64 bit box using Java 1.7 and jruby 1.6.5 using the 1.9 lang option

see here:

jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot™ 64-Bit Server VM 1.7.0_02) [Windows 7-amd64-ja
va]

Note: What file or directory is it looking for ? thanks.

stack:

C:\Users\cod2\GIT\sandbox\JRuby\Scrape>jruby -S rake big_jar—trace
(in C:/Users/cod2/GIT/sandbox/JRuby/Scrape)
  • Invoke big_jar (first_time)
  • Invoke install_gems (first_time)
  • Invoke vendor (first_time, not_needed)
  • Execute install_gems
    jruby -S gem install -i vendor hpricot
    Successfully installed hpricot-0.8.5-java
    1 gem installed
  • Invoke build_launcher (first_time)
  • Execute build_launcher
    javac -cp jruby-complete.jar Launcher.java
  • Invoke extract_jruby (first_time)
  • Invoke tmp (first_time, not_needed)
  • Execute extract_jruby
    jar -xf ../jruby-complete.jar
  • Execute big_jar
    jar -cfm scrape.jar big.manifest Launcher.class scrape.rb \ -C vendor . -C tmp .
    \ : no such file or directory
    rake aborted!
    Command failed with status (1): [jar -cfm scrape.jar big.manifest Launcher….]
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh’
    org/jruby/RubyProc.java:258:in `call’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1098:in `sh’
    C:/Users/cod2/GIT/sandbox/JRuby/Scrape/Rakefile:43:in `(root)’
    org/jruby/RubyProc.java:258:in `call’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute’
    org/jruby/RubyArray.java:1612:in `each’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain’
    C:/jruby-1.6.5/lib/ruby/1.9/monitor.rb:201:in `mon_synchronize’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level’
    org/jruby/RubyArray.java:1612:in `each’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run’
    C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31:in `(root)’
    org/jruby/RubyKernel.java:1073:in `load’
    C:/jruby-1.6.5/bin/rake:19:in `(root)’

C:\Users\cod2\GIT\sandbox\JRuby\Scrape>

10 Jan 2012, 01:17
Mr_sketchy_pragsmall

Ian Dees (192 posts)

Hi, Charles.

Do you have the latest jruby-complete build downloaded and saved into your project directory as jruby-complete.jar (with no trailing version numbers)?

Does the error persist if you try the same example from the latest version of the book’s source code?

—Ian

10 Jan 2012, 01:28
Mr_sketchy_pragsmall

Ian Dees (192 posts)

Hi, Charles.

I think I’ve found the culprit. When JRuby shells out to run the jar command, the shell treats the backslash in the shell command as the path C:\, instead of treating it as an “ignore this newline” character.

You can either remove the backslash and newline from the command inside the Rakefile (which we only broke across lines to fit in the book), like this:

sh 'jar -cfm scrape.jar big.manifest Launcher.class scrape.rb -C vendor . -C tmp .'

... or change the single quotes to double quotes, like so:

sh "jar -cfm scrape.jar big.manifest Launcher.class scrape.rb \
-C vendor . -C tmp ."

Hope this helps…

—Ian

27 Jan 2012, 05:25
Generic-user-small

Charles A. Monteiro (7 posts)

Ian, thanks, I took a detour off from JRuby partially since I just need to finish some Ruby work and partially because well I was getting stuck with JRuby. I’m definitely keen on getting up to speed, JRuby is very compelling and they seem to keep up close to the MRI releases. I will put this on my queue to check out by the end of the next week.

-Charles

  You must be logged in to comment