Delete files in use
已回答
I develop plugin which can connect to databases. DB drivers jar files are added by users, contains in plugins/my-plugin/lib and loaded to classpath on IDEA start. In Windows user can’t delete files via plugin GUI - they are using by IDEA.
Is there a way to delete these files without closing IDEA or on exit/restart?
请先登录再写评论。
I do not quite understand why it is necessary to delete these files, when they are part running classpath of IDE? OTOH Windows locking JAR files is a general problem.
Sometimes users may want to replace the driver. I want to support this case in GUI.
I'm not sure it is possible to workaround these problems, so if I may I would suggest an alternative:
Database functionality in IJ has ability to use driver JAR files downloaded to arbitrary location. They also come with predefined defaults that can be downloaded/installed with one click. They're added only to classpath when used to execute queries against database, freeing them from being included in the plugin's classpath and all resulting problems.
Is it possible to use this functionality programmatically?