You can create your backend for a web data connector in whatever language you want. So long as it renders as HTML, the backend language isn't relevant.
The Github repository is the best resource - GitHub - tableau/webdataconnector
As per the web data connector sdk api, I need to run the command python -m SimpleHTTPServer 8888 (start_server_mac.sh) to create web connector instance.Otherwise it is not working.
I would like to use html pages as part of web application and the web connector should work on same port where my normal web application running.
Do we have any alternative way to avoid python command and use java
You don't have to use that example.
Scroll down and take a look at the 'Official Tableau WDC Samples' on the home page. I.e. the mad money scraper - webdataconnector/MadMoneyScraper.html at gh-pages · tableau/webdataconnector · GitHub
Like I said, the web data connector will consume anything that prepares and delivers HTML, JSON, XML etc. You should start with the 'getting started' rather than diving into samples - https://onlinehelp.tableau.com/current/api/wdc/en-us/help.htm