Thursday, September 2, 2021

Build Java example for Salesforce Streaming API

 There is a decent example Salesforce provides if you need to start a quick PoC for applications using the Streaming API.  I set out to do just that.

 After cloning the repo, it's a simple "mvn clean package" to build the app but of course I didn't have Maven on the computer.  Installing it was very quick. After rerunning the build it gave me "no compiler is provided in this environment. perhaps you are running on a jre rather than a jdk?"  I have the issue have more than one Java installations, and Murphy's law dictates that my JAVA_HOME has to point to one that is a JRE.  There's a nice solution here, and I got lazy and simply stick a line to set JAVA_HOME in my mvn shell (the mvn file in Maven's bin folder).

 export JAVA_HOME=`/usr/libexec/java_home -v1.8.0`

 Once that's done the build went through like a charm!

No comments:

Post a Comment