I'm working on a demo for Google App Engine that connects to one of our Salesforce.com Sandboxes (hope to be done tomorrow or Monday). The Force.com Web Service Connector (WSC) project has a partner-library.jar that you can download and add to your project to get up and running quickly. However, if you want to connect to a Sandbox you have to download your Partner WSDL from your Sandbox and compile it with the wsc-gae-160.jar to generate the stub code.

To generate the stub code, run the following from the terminal:

java -classpath wsc.jar com.sforce.ws.tools.wsdlc wsdl jar.file

Where wsdl is the name of the partner WSDL file you downloaded and jar.file is the output jar file that is generated.

The problem is that seems to throw an exception on a Mac:

Exception in thread "main" java.lang.NullPointerException
at com.sforce.ws.tools.wsdlc.checkTargetFile(wsdlc.java:115)
at com.sforce.ws.tools.wsdlc.(wsdlc.java:66)
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:288)
at com.sforce.ws.tools.wsdlc.main(wsdlc.java:279)


The fix is documented here but you essentially need to supply the entire path for the outputted jar file:

java -classpath wsc-gae-16_0.jar com.sforce.ws.tools.wsdlc chatter-sandbox-partner.wsdl /users/jeff/desktop/chatter-sandbox-partner.jar