Use snprintf instead of sprintf

Use `snprintf` instead of `sprintf` to avoid potential (security) issues when encountering a ridiculously long `CLASSPATH`.