0

I'm trying to use some dependencies in JNI-rs. The following is the class which I need to use:

org.quartz public class JobDataMap
extends org.quartz.utils.StringKeyDirtyFlagMap
implements java.io.Serializable
Maven: org.quartz-scheduler:ali-quartz:2.3.1-SNAPSHOT

So according to the above information, I guess I should set the class.path by:

.option("-Djava.class.path=/Users/slhmy/Workplace/traffic-simulation/traffic-simulation-web-rs/quartz-db/jars")

I have put the related jar to this path:

quartz-db/jars/ali-quartz-2.3.1-SNAPSHOT.jar

But I still fail to find class

// panic here
let class_job_data_map = env.find_class("org/quartz/JobDataMap").unwrap();
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
Exception in thread "Thread-0" java.lang.NoClassDefFoundError: org/quartz/JobDataMap
Caused by: java.lang.ClassNotFoundException: org.quartz.JobDataMap
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)

Is there any step I did wrong or I have fogort?

slhmy
  • 11
  • 4
  • 1
    Assuming that this API is about specifying standard options of the Java launcher, you should use `-classpath …` instead of `-Djava.class.path=…` and the path must lead to the jar file itself or end with `/*` – Holger Jun 03 '21 at 16:45
  • Thanks. But I failed to set `-classpath` by `.option`. I tried `Xbootclasspath/a:`, this arg seems to be added successfully but also can't fix my CLASSNOTFOUND issue. I'm really sorry for I'm not so familiar with the JAVA settings. So if could, I would like to know the specific usage of these class related args. – slhmy Jun 05 '21 at 05:50
  • 1
    How do you determine that one option has been set and the other hasn’t, when the result is all the same? If you are not familiar with the options, I suggest trying to invoke the software from the command line to gain familiarity and preclude the interaction with the JNI API as a source of errors. Once you understood how to invoke the software, try to reproduce the command with rust and JNI. – Holger Jun 07 '21 at 08:19

0 Answers0