MarkusJx / node-java-bridge

A bridge between Node.js and Java
https://markusjx.github.io/node-java-bridge/
MIT License
112 stars 6 forks source link

no error message occurs if wrong MS Visual C++ Redist. is installed #75

Closed tripower closed 1 year ago

tripower commented 1 year ago

I have had the problem that after the require of the bridge

console.log("info 1");
const {importClass} = require('java-bridge');
console.log("info 2");
const  java = require('java-bridge');
console.log("info 3");

nothing else happened my app starts but the beidge was not working no info, error... only the Output info 1

I only saw that an old MS Visual C++ Redist. (Version 2012) was installed same happens if nothing is installed

for try and error I installed MS Visual C++ 2015 Red. x86 and than it was working

so would it be possible to write console log or other infos If in the background of the bridge something goes wrong?

MarkusJx commented 1 year ago

If no error is thrown, there is actually nothing to be logged. All errors that may occur in the backend are directly returned to the node process, in some way.

Your issue may be actually caused by java missing some dependencies, preventing the addon from properly starting. This could be a downside to loading the libraries dynamically...

Anyways, I'll add the information to the readme

tripower commented 1 year ago

ok Pity hoped that another try catch or check in your backend could detect it maybe you have an idea but thanks for doc 🤗

@MarkusJx can you reproduce it or have you an idea how I can check it because "it dies silently" :D also try / catch around the line with importClass was not successful :(

MarkusJx commented 1 year ago

I've tried to reproduce this issue on a windows 10 x64 (I wasn't able to get a x86 one working) vm running node 18 and java 17, but no luck there.

If it dies without throwing any errors, there may be a native dependency version mismatch causing the crash, which is somewhat likely as adding the required dependencies resolves the issue. In this case, using try...catch won't work, as this doesn't catch native crashes, just node errors. Usually, an error popup should appear, telling you about missing dependencies.

If not and you want to check for the dependencies yourself, try searching for vcruntime140.dll on the target system. This one is required by the addon and will be installed with the vc redistributable for vs 2015 (https://www.microsoft.com/en-gb/download/details.aspx?id=48145).

Or you could just ship the dll with your application, although I don't know how to do that but you wouldn't really use dlls as they are supposed to be used.

tripower commented 1 year ago

ok thank you for the effort

@MarkusJx the same problem was also if no MS Visual C++ is installed so that must be reproducible

tripower commented 1 year ago

guten Morgen

nochmals kurz zum Thema in deinem Rust bzw Cpp Code kannst auch nichts checken oder anfangen und selbst einen Error werfen?

liebe Grüße Klaus

Markus @.***> schrieb am Mi., 24. Mai 2023, 18:31:

I've tried to reproduce this issue on a windows 10 x64 (I wasn't able to get a x86 one working) vm running node 18 and java 17, but no luck there.

If it dies without throwing any errors, there may be a native dependency version mismatch causing the crash, which is somewhat likely as adding the required dependencies resolves the issue. In this case, using try...catch won't work, as this doesn't catch native crashes, just node errors. Usually, an error popup should appear, telling you about missing dependencies.

If not and you want to check for the dependencies yourself, try searching for vcruntime140.dll on the target system. This one is required by the addon and will be installed with the vc redistributable for vs 2015 ( https://www.microsoft.com/en-gb/download/details.aspx?id=48145).

Or you could just ship the dll with your application, although I don't know how to do that but you wouldn't really use dlls as they are supposed to.

— Reply to this email directly, view it on GitHub https://github.com/MarkusJx/node-java-bridge/issues/75#issuecomment-1561543301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7ECHSZPS5BUZSSBCT6YO3XHYZXFANCNFSM6AAAAAAYND56YM . You are receiving this because you authored the thread.Message ID: @.***>