[WIP][SPARK-1720][SPARK-1719] use LD_LIBRARY_PATH instead of -Djava.library.path

- [X] Standalone
- [X] YARN 
- [X] Mesos
- [X]  Mac OS X
- [X] Linux 
- [ ]  Windows
 
This is another implementation about #1031
Can you add a java doc, something like
```
/**
 * Build a command based on the given one, taking into account the local environment of where
 * this command is expected to run, substitute any placeholders, and append any extra class paths.
 * The `env` argument is exposed for testing.
 */
```