I am having a java program (sample1.java)in the path /var/lib/asterisk/agi-bin. my servlet program(sample2.java) is in another path /usr/local/apache-tomcat/webapps/voicebroadcast/WEB-INF/classes.
If you need some business logic provided by the other servlet, then that servlet code is likely subject to refactoring. Separate the tight coupled code into separate class(es) so that you could reuse it in another (servlet) classes.
If you actually need to access the servlet by HTTP request and you need its HTTP response programmatically, then take a look for java.net.URLConnection or, a bit more enhanced, the Apache Commons HttpClient API.
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad: