Q:

How to deploy Car and bar file programatically in wso2

In wso2 how to deploy .car file in case of ESB and .bar in case of BPMN programatically. Is there any way of using remote deployment option programmatically(using JAVA).

A:

You can use the admin services which are exposed as SOAP services to achieve the requirement. For example, you can use bellow endpoint to deploy Carbon Application(car file). 
https://{esb-host-name}:{esb-management-console-port}/services/CarbonAppUploader

Also for BPMN(bar file), you can use bellow endpoint. 
https://{bps-host-name}:{bps-management-console-port}/services/BPMNUploaderService

The blog post [1] will help to understand the flow. 

