Yes, but you have to use the correct method of storing the sessionId. There are two possibilities depending on how the server is configured:
cookie based (the default) - the sessionId is kept in a cookie which needs to be transmitted with each request made
url rewriting - the sessionId is encoded into the url like in the example you link to
Most likely you should be using the cookie approach. the Apache HttpClient API makes that quite easy to do, I suggest you investigate it.
I'm using url rewriting approach and this works fine between different calls from swing to servlet. I mean, the sessionid is created by the first call from swing to servlet and the session is maintained between the following calls.
The servlet appends in the header of the response the sessionid :