Can JNI be made to honour wildcard expansion in the classpath?

前端 未结 2 1020
北荒
北荒 2021-01-12 18:20

I have a C binary that calls out to Java via JNI. I set CLASSPATH to somedir/* to pick up all the jars in somedir.

When I run the binary, a required class definition

2条回答
  •  广开言路
    2021-01-12 19:11

    No. No, it cannot. Using JNI doesn't help.

    The way you would do this is by implementing your own class loader (in Java), but that class loader would have to be in the wildcard-free CLASSPATH.

    You could, of course, set the CLASSPATH to its expanded form before invoking the JVM. That would work and could be done via a shell script (no JNI needed).

提交回复
热议问题