System.getProperty returns null for defined property
Java system properties have nothing to do with shell environment variables.
You can assign a java system property when you invoke the virtual machine, for example:
java -DTOOLS_DIR=/somewhere org.example.MyClass
Environment variables and properties aren't the same thing. If you want to pass in an environment variable as property you have to add the following to your java invocation:
-DTOOLS_DIR=$TOOLS_DIR
Alternatively, you can use System.getEnv()
Try this instead:
String toolsDir = System.getenv("TOOLS_DIR");
The getProperty(...) method returns java vm properties (like user.dir, java.version). The getenv(...) method is for environment variables.