Will_Panda
Will_Panda

Reputation: 534

Re-loading java classpaths while JVM is up through JNI

I have a C++ process that starts the JVM through JNI.

I know that I can't initialize JVM after destroying it. (Create JVM after destroying it) If this could be done in any way there is no issue because I can give new classpaths and create the JVM again. Hence the JVM cannot be created after destroying I keep it up throughout my C++ process.

But I need to update the Java classpaths dynamically at the runtime as new Java files get created and compiled through my C++ process.

Is there a way to reload the Java classpaths through JNI while the JVM is up?

Upvotes: 0

Views: 317

Answers (1)

apangin
apangin

Reputation: 98314

It is possible to add new classpath segments in runtime using JVM TI functions AddToBootstrapClassLoaderSearch and AddToSystemClassLoaderSearch.

Upvotes: 1

Related Questions