arton / rjb

Ruby Java Bridge
https://www.artonx.org/collabo/backyard/?RubyJavaBridge
GNU Lesser General Public License v2.1
117 stars 34 forks source link

[!] rjb cannot be installed and run on windows #95

Closed winezer0 closed 6 months ago

winezer0 commented 1 year ago

OS: windows 10 Lang: Chinese

BUG 1:

In a Chinese Env, the 'javah -version' invoked by the rjb installation cannot be matched with a normal RE, indicating an encoding error

javah -version
javah版本 "1.8.0_261"

BUG1 Cause::rjb/ext/extconf.rb does not support Chinese encoding matching, please modify the code.

image

Temporary fix for BUG1:Change the language of the OS to english.

BUG 2:

After installing rjb with a temporary fix, every time you run the program:

[!] Partially dependent java plugins cannot be used normally
winezer0 commented 1 year ago

Please help me deal with this problem, thank you very much

arton commented 6 months ago

@winezer0 Sorry for the late response. I'll fix it asap.

arton commented 6 months ago

Hi @winezer0, I can't reproduce this issue, I wonder if you could attach or copy&paste the extconf.rb output.

winezer0 commented 6 months ago

Thank you very much for your reply.

After My analysis, the problem is mainly caused by two reasons:

1 The jdk version cannot be obtained correctly

On windows environment, when I run 'javah-version', the output Chinese result or Or because the output is not captured, I recompiled the rjb code by modifying it

run raw extconf.rb on windows:

image

run gem install rjb:

image

run javah -version on windows:

image

my fix extconf.rb code:

# cversion = (javac -version =~ /\d+.\d+.\d+/ ) ? $& : nil javac_output = javac -version 2>&1 match = javac_output.match(/\d+.\d+.\d+/)
cversion = match ? match[0].to_s : nil
# hversion = (javah -version =~ /\d+.\d+.\d+/ ) ? $& : nil hversion = cversion puts "cversion:#{cversion}" puts "hversion:#{hversion}"

image

run my new extconf.rb on windows:

image

2. The rjb plug-in RuntimeError: can't create Java VM

Recompile and generate by configuring the environment

ruby setup.rb config ruby setup.rb setup ruby setup.rb install gem build rjb.gemspec gem install rjb-1.6.9-x64-mingw-ucrt.gem

However, there is still a JVM error

How should we deal with this issue? It seems to me that the issue of history has not been dealt with, is it impossible to solve it https://github.com/arton/rjb/issues/34

image

You can test a windows environment running rjb to see if it works

winezer0 commented 6 months ago
rjb>cd test

rjb\test>ruby test.rb
start RJB(1.6.9) test
Loaded suite test
Started
E
Error: test_64fixnum(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_CallByNullForArrays(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_CastObjectArray(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_add_jar(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_add_jars(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
............
E
Error: test_combination_charcters(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_comparator(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
............
E
Error: test_fetch_method_without_signature(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_fetch_static_method_signature(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_field(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_fornamehook(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_generics_map(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_impl(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_import_and_instanciate(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_importobj(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
Error: test_importobjarray(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'
E
............
E
Error: test_underscored_constant(TestRjb): RuntimeError: can't create Java VM
test.rb:21:in `load'
test.rb:21:in `setup'

Finished in 0.399002 seconds.
------------------------------------------------------------------------------------------------------------------------70 tests, 0 assertions, 0 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
------------------------------------------------------------------------------------------------------------------------175.44 tests/s, 0.00 assertions/s
winezer0 commented 6 months ago

wait for your

winezer0 commented 6 months ago

I will test in windows environment, please wait

winezer0 commented 6 months ago

Very good, thank you very much,

now rjb is running successfully on windows