@sachinrathod
For Java, I suggest you to use Splunk JAVA SDK for that. Please refer below links.
https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtodisplaysearchsdkjava/
https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtoworkjobjava/
https://www.youtube.com/watch?v=BIexh3aSn8c