0

I got a small question: (How) can I run some java code (preferable a jar) in its own JVM, in best case specifying my own libs. So for example to sandbox all file system access.

What of this stuff is possible, and how?

6
  • Do you mean "running some java code" within its own VM started from other Java code ? Commented Apr 12, 2013 at 15:28
  • yes, I want to run some java code in a sandbox launched and controlled from java Commented Apr 12, 2013 at 15:33
  • 1
    Its entirely possible. You will have to write the code though. It involves (optionally) writing your own classloader, installing a security manager, and defining a set of policy files. Commented Apr 12, 2013 at 15:35
  • stackoverflow.com/questions/1715036/… Commented Apr 12, 2013 at 15:36
  • Yes,a customed classloader Commented Apr 12, 2013 at 15:37

1 Answer 1

2

To limit access to the file system or any other resource, make use of Java's Security Manager. See http://docs.oracle.com/javase/7/docs/technotes/guides/security/index.html for information on how to configure a policy.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.