1 2 3 | [root@san]# export JAVA_HOME=/usr/local/jdk60 [root@san]# export PATH=$PATHJAVA_HOME/bin |
1 2 3 4 5 6 7 8 9 | [root@san]# unzip rjb-1.1.3.zip [root@san]# cd rjb-1.1.3 [root@san]# ruby setup.rb config [root@san]# ruby setup.rb setup [root@san]# ruby setup.rb install |
1 | [root@san]# irb |
1 2 3 4 5 | irb(main):001:0> require 'rjb' => true irb(main):002:0>exit |
1 2 3 4 5 | [root@san]# export JAVA_HOME=/usr/local/jdk60 [root@san]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATHJAVA_HOME/jre/lib/i386 [root@san]# export LD_LIBRARY_PATH=$LD_LIBRARY_PATHJAVA_HOME/jre/lib/i386/client |
1 | require 'rjb' |
1 | Rjb::load(classpath = '.:/path/to/tar.jar', jvmargs=[]) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | tararchive = Rjb::import('com.ice.tar.TarArchive') fileinputstream = Rjb::import('java.io.FileInputStream') file = Rjb::import('java.io.File') file_instance = file.new_with_sig('Ljava.lang.String;','.') fileinputstream_instance = fileinputstream.new_with_sig('Ljava.lang.String;','test.tar') tararchive_instance = tararchive.new_with_sig('Ljava.io.InputStream;',fileinputstream_instance) p "Let's verify that the objects created are indeed of the classes we wanted..." p "------------------------------" p "For the File instance...." p "Expecting: java.io.File , it is: " + file_instance._classname p "------------------------------" p "For the FileInputStream instance...." p "Expecting: java.io.FileInputStream , it is: " + fileinputstream_instance._classname p "------------------------------" p "For the TarArchive instance...." p "Expecting: com.ice.tar.TarArchive , it is: " + tararchive_instance._classname |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |