~/NetBeansProjects/jruby ➔ cat vm_thing.rb 
require 'jruby/vm'

child_vm = JRuby::VM.spawn('-e', <<'END')
  puts "in child: #{JRuby::VM_ID}"
  parent = JRuby::VM.get_message
  puts "parent = #{parent}"
  JRuby::VM.send_message(parent, JRuby::VM_ID)
END

puts "in parent: #{JRuby::VM_ID}"
child_vm.send(JRuby::VM_ID)
child = JRuby::VM.get_message
puts "child = #{child}"

puts child_vm.stdout.read
~/NetBeansProjects/jruby ➔ jruby vm_thing.rb 
in parent: 7214088
child = 22527820
in child: 22527820
parent = 7214088