I have a java script that generates strings on my data. Is there any way I can use POST on my Xampp Localhost PHP to receive the data string from the java program and echo it out on my PHP page?
You can use the HttpURLConnection object to make a request to localhost. Please see this question and this tutorial.