Delete files in use

Answered

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?

4 comments
Comment actions Permalink

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.

0
Comment actions Permalink

Sometimes users may want to replace the driver. I want to support this case in GUI.

0
Comment actions Permalink

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.

0
Comment actions Permalink

Is it possible to use this functionality programmatically?

0

Please sign in to leave a comment.