How to run java code in a restricted sandbox (without network, filesystem access)
This page describes the process in detail:
http://www.jayway.com/2014/06/13/sandboxing-plugins-in-java/
You can control the environment using policy files http://docs.oracle.com/javase/1.4.2/docs/guide/security/PolicyFiles.html#Examples (archived version @archive.org)
you could run then run your jar
java -Djava.security.manager -Djava.security.policy=/path/your_policy_file.policy -jar