Fix/improve npm test compatibility on windows

Add some changes to enable Windows users to run `npm start` and `npm test`.
(It still relies on `node` and `java` being available in the environment PATH.)
Indeed, on non-windows OSes, it won't change anything but it's just a habit of mine not to call a function that I know won't have any effect. It's some minor performance optimisation if any...