How to start Appium server 2.0 Programmatically

I am aware of starting Appium 1.x programmatically but not able to do it for Appium 2.0

AppiumServiceBuilder builder = new AppiumServiceBuilder();
    builder.usingDriverExecutable(new File("<path to Node>\\node.exe"));
    builder.withAppiumJS(new File("<path to Appium>\\appium"));
    HashMap<String, String> environment = new HashMap();
    environment.put("PATH", "/usr/local/bin:" + System.getenv("PATH"));
    service = AppiumDriverLocalService.buildService(builder);


install appium 2.0 using below command

npm install -g appium@next

Make sure there path for nodejs in system environment variable In User Variable add new Key NODE_PATH and APPIUM_PATH

For NODE_PATH put value as C:\Program Files\nodejs\node.exe

For APPIUM_PATH put value as C:\Users<user_name>\AppData\Roaming\npm\node_modules\appium\node_modules.bin

In this case it will start Appium Server 2.0 but test will still fail with No route found for /wd/hub/session"

I am working on it with reference to