you will have to create a http server of your bot (doc link is provided in above thread by souvik)… After that you will have to query it by using the url (in your java code)
http://localhost:5005/conversations/default1/respond?token=auth_token
{“q”:“Your query”}