How to set Classpath in OpenApi?

I have saw some post talk about it. But they are totaly not work.
This is their code.

VirtualFile midApiJar = LocalFileSystem.getInstance().findFileByPath(midApiPath.replace(File.separatorChar, '/'));
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = rootManager.getModifiableModel();
Library.ModifiableModel libraryModel = rootModel.getModuleLibraryTable().createLibrary().getModifiableModel();
libraryModel.addRoot(midApiJar, OrderRootType.CLASSES);
try {
} catch (ModuleCircularDependencyException e) {

Even it can set the classpath to UI sucessfully. But the class stil cannot be found. Is this anymore should i do for the code?

Please sign in to leave a comment.