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:
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