Con't initialize jvm
when i initialize a jvm, like this:
let entry = ClasspathEntry::new("/workspace/code/zenoh-flow-java/zenoh-flow/out/artifacts/zenoh_flow_jar/zenoh-flow.jar");
let ja = JvmBuilder::new()
.with_default_classloader()
.classpath_entry(entry)
.build()
.unwrap();
I got this panick:
thread 'Result::unwrap() on an Err value: GeneralError("Error { kind: NotFound, message: "No such file or directory (os error 2)" }")',
I cannot say what throws this error. However, I can say that if a ClasspathEntry is not found, or is not a valid path, the Jvm is created without issues. It is just that the jar specified is not in the classpath and therefore, when you need it later, you will get a Exception from Java like:
Exception in thread "main" org.astonbitecode.j4rs.errors.InstantiationException: Cannot create instance of blah.blah.Blah at org.astonbitecode.j4rs.api.instantiation.NativeInstantiationImpl.instantiate(NativeInstantiationImpl.java:47) Caused by: java.lang.ClassNotFoundException: blah.blah.Blah at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) at org.astonbitecode.j4rs.utils.Utils.forNameEnhanced(Utils.java:56) at org.astonbitecode.j4rs.api.instantiation.NativeInstantiationImpl.createInstance(NativeInstantiationImpl.java:96) at org.astonbitecode.j4rs.api.instantiation.NativeInstantiationImpl.instantiate(NativeInstantiationImpl.java:44)
Please give more details, running j4rs with debug logging enabled.
when i export " J4RS_CONSOLE_LOG_LEVEL=debug", it seems not work. I guess it has something to do with the JAVA_HOME environment variable? Or the libjvm.so file. Can you tell me how JVM gets these files?
when i export " J4RS_CONSOLE_LOG_LEVEL=debug", it seems not work.
Do you mean that debugging did not work? I asked to add the property in order to have more logging and maybe see what happens. Can you please provide these logs? Without it, there is not much we can do.
If JAVA_HOME is not correctly set, j4rs cannot locate the JVM and you may have this error.
It's been some time since this is inactive. Closing...