JRuby
unread,Jul 27, 2011, 4:48:28 PM7/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rawr-lib
Pulling my hair out on this one -- can't seem to get the equivalent of
"hello world" to work. Was working on a larger project, had some
difficulties and tried a small skeleton:
jruby@jruby:~/hello_rawr$ cd ..
jruby@jruby:~$ mkdir hello_rawr
jruby@jruby:~$ cd hello_rawr/
jruby@jruby:~/hello_rawr$ rawr install
Running in jruby 1.6.3 (ruby-1.8.7-p330) [linux-amd64-java]
Create rawr files using {:wordy=>false,
:class=>"org.rubyforge.rawr.Main",
:directory=>"src",
:build_config_file=>"build_configuration.rb",
:local_jruby_jar=>nil,
:no_config=>"false",
:show_version=>false,
:no_download=>"false",
:no_jar=>"false",
:command=>["install"]}
write config file
Creating Rawr configuration file build_configuration.rb
option project_name: hello_rawr
option output_dir: package
option main_ruby_file: main
option main_java_file: org.rubyforge.rawr.Main
option source_dirs: src
option source_exclude_filter:
option compile_ruby_files: true
option java_lib_files:
option java_lib_dirs: lib/java
option files_to_copy:
option target_jvm_version: 1.6
option jvm_arguments:
option java_library_path:
option extra_user_jars:
option mac_do_not_generate_plist:
option mac_icon_path:
option windows_icon_path:
Creating Java class /home/jruby/hello_rawr/src/org/rubyforge/rawr/
Main.java
Creating Rakefile ...
Downloading jruby-complete.jar. This may take a moment...
All done!
jruby@jruby:~/hello_rawr$ cat > src/main.rb
puts "hello world!"
jruby@jruby:~/hello_rawr$ rake rawr:jar
(in /home/jruby/hello_rawr)
mkdir -p package/classes/java
javac -target 1.6 -cp lib/java/jruby-complete.jar:src -sourcepath src -
d package/classes/java src/org/rubyforge/rawr/Main.java
mkdir -p package/classes/ruby
Compile src/main.rb into package/classes/ruby/main.class
compile_dirs has src_dirs = ["src"]
glob_ruby_files has directory 'src' glob ["src/main.rb"]
files for src: 1
ruby_globs.each has glob_data = #<OpenStruct files=["main.rb"],
directory="src">
Go compile ["src/main.rb"]
mkdir -p package/classes/META-INF
mkdir -p package/jar
=== Creating jar file: package/jar/hello_rawr.jar
cp lib/java/jruby-complete.jar package/jar/lib/java/jruby-
complete.jar
jruby@jruby:~/hello_rawr$ java -jar ./package/jar/hello_rawr.jar
Exception in thread "main" org.jruby.exceptions.RaiseException:
(LoadError) no such file to load -- main
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:
1038)
at #<Class:0x15b14a306>.(root)(<script>:1)
jruby@jruby:~/hello_rawr$
This is with jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f)
(OpenJDK 64-Bit Server VM 1.6.0_22) [linux-amd64-java]