When using java taks you have to pass the values of process variables into the invoked method. You can then use the values but not change the variables. If you want to have direct access to the execution and thus to the variables use a custom task instead of a java task. Refert to the user guide for passing variables into invoked methods and for more information on how to use a custom task.
I will have to go by custom tasks as I have to update the process variables
because I am migrating from JBPM 3.2 to JBPM 4.3 and all my node and action
got converted to java tasks by default and unlike JBPM3.2 I do not have a handle to the exceution context.