How do I publish a message containing a JSONObject in string form via the Java API?

First, create a JSONObject from the string you want to publish:

JSONObject jso = new JSONObject("your string message here");

Then pass the JSONObject to the following Java publish API call:

public void publish(
    java.lang.String channel, 
    org.json.JSONObject message, 
    Callback callback)