Figured it out. When creating the process variable, you have to define it as Object and provide the package path in Class Name. Instead of just creating an object, for example, of type Person, I had to actually type com.sample.Person, where com.sample is the package name. All variable reading and altering (get and set methods) is done with kcontext.getVariable("var") and kcontext.setVariable("var", newValue).