Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to limit file access of certain classes to a certain directory?

Tags:

java

I am creating a plugin system which dynamically loads classes, and since the plugins are user created, I want to restrict their access to everywhere but a working directory. Is there a solution for this in Java?


1 Answers

Basically the JVM offers the Security manager architecture.

One part of that are FilePermissions, which enable some sort of control here.

But note: this is really an advanced topic, and easy to get wrong, but your primary use case of isolating plugins coming from different packages should be doable.

like image 52
GhostCat Avatar answered Jan 23 '26 01:01

GhostCat