2

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

2
  • Can you expose you Java class via a REST or SOAP web service? Then you could call out to it from Salesforce. Aug 22, 2014 at 6:57
  • Porting the class to Apex (as the languages are similar) and hosting it directly in the org that contains your Visualforce page is worth considering. But how reasonable that is depends on how big the Java class is and whether the Java APIs it uses are also available in Apex..
    – Keith C
    Aug 22, 2014 at 7:01

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .