[SalesForce] How To Call A Java Class Method from Salesforce

Here I have one custom button in a VIsualforce page and one java class in netbeans, and what I want exactly is that whenever I click on custom button at that time iI want to run that java class.

So basically want to access java class from the salesforce.

For that what can I do for that? If possible please give me one demo example regarding that.

I am very thankful if i get help.

Thanks in Advance

Best Answer

You will need to write a web service and host this web service. Then you can call this web service from VF page. In background you web service can call your java class.

Here is example of how you can call external web service.

Calling an external REST service in apex

Here is example of how you can host web service.

http://www.vogella.com/tutorials/REST/article.html

Note that you will need to host your web service on internet (not on local host) so that sales force can access it.

Related Topic